NST OF ST4ND & TECH R.I.C.

A111Q3 aiHDsa

Computer

Systems

Technology

U.S. DEPARTMENT OF

COMMERCE

Technology Administration

National Institute of Standards £ind Technology

Nisr

1

NISI Special KuDiication o0u-2U3

Conformance Test Specification:

for COBOL Intrinsic

Function Module

Carmelo Montanez-Rivera

L. Arnold Johnson

NIST

PUBLICATIONS

m

-QC

I 100

LU57

[ 500-203

I 1992

! C.2
7he National Institute of Standards and Technology was established in 1988 by Congress to "assist industry in the development of technology . , . needed to improve product quality, to modernize

manufacturing processes, to ensure product reliability . . . and to facilitate rapid commercialization ... of

products based on new scientific discoveries."

NIST, originally founded as the National Bureau of Standards in 1901, works to strengthen U.S.

industry's competitiveness; advance science and engineering; and improve public health, safety, and the

environment. One of the agency's basic functions is to develop, maintain, and retain custody of the national

standards of measurement, and provide the means and methods for comparing standards used in science,

engineering, manufacturing, commerce, industry, and education with the standards adopted or recognized

by the Federal Government.

As an agency of the U.S. Commerce Department's Technology Administration, NIST conducts basic

and applied research in the physical sciences and engineering and performs related services. The Institute does generic and precompetitive work on new and advanced technologies. NIST's research facilities are

located at Gaithersburg, MD 20899, and at Boulder, CO 80303. Major technical operating units and their

principal activities are listed below. For more information contact the Public Inquiries Desk, 301-975-3058.

Technology Services

• Manufacturing Technology Centers Program

• Standards Services

• Technology Commercialization

• Measurement Services

• Technology Evaluation and Assessment

• Information Services

Electronics and Electrical Engineering

Laboratory

• Microelectronics

• Law Enforcement Standards

• Electricity

• Semiconductor Electronics

• Electromagnetic Fields^

• Electromagnetic Technology^

Chemical Science and Technology

Laboratory

• Biotechnology

• Chemical Engineering'

• Chemical Kinetics and Thermodynamics

• Inorganic Analytical Research

• Organic Analytical Research

• Process Measurements

• Surface and Microanalysis Science

• Thermophysics^

Physics Laboratory

• Electron and Optical Physics

• Atomic Physics

• Molecular Physics

• Radiometric Physics

• Quantum Metrology

• Ionizing Radiation

• Time and Frequency*

• Quantum Physics*

Manufacturing Engineering Laboratory

• Precision Engineering

• Automated Production Technology

• Robot Systems

• Factory Automation

• Fabrication Technology

Materials Science and Engineering

Laboratory

• Intelligent Processing of Materials

• Ceramics

• Materials Reliability*

• Polymers

• Metallurgy

• Reactor Radiation

Building and Fire Research Laboratory

• Structures

• Building Materials

• Building Environment

• Fire Science and Engineering

• Fire Measurement and Research

Computer Systems Laboratory

• Information Systems Engineering

• Systems and Software Technology

• Computer Security

• Systems and Network Architecture

• Advanced Systems

Computing and Applied Mathematics

Laboratory

• Applied and Computational Mathematics^

• Statistical Engineering^

• Scientific Computing Environments^

• Computer Services^

• Computer Systems and Conununications^

• Information Systems

»At Boulder, CO 80303. ^Some elements at Boulder, CO 80303.
QCIOO

Conformance Test Specifications

for COBOL Intrinsic

Function Module

Carmelo Montanez-Rivera

L. Arnold Johnson

Computer Systems Laboratory

National Institute of Standards and Technology

Technology Administration

Gaithersburg, MD 20899

July 1992

U.S. DEPARTMENT OF COMMERCE

Barbara Hackman Franklin, Secretary

TECHNOLOGY ADMINISTRATION

Robert M. White, Under Secretary for Technology

NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY

John W. Lyons, Director
Reports on Computer Systems Technology

The National Institute of Standards and Technology (NIST) has a unique responsibility for computer

systems technology within the Federal government. NIST's Computer Systems Laboratory (CSL) develops standards and guidelines, provides technical assistance, and conducts research for computers and

related telecommunications systems to achieve more effective utilization of Federal information technology resources. CSL's responsibilities include development of technical, management, physical, and administrative standards and guidelines for the cost-effective security and privacy of sensitive unclassified

information processed in Federal computers. CSL assists agencies in developing security plans and in improving computer security awareness training. This Special Publication 500 series reports CSL re- search and guidelines to Federal agencies as well as to organizations in industry, government, and

academia.

National Institute of Standards and Technology Special Publication 500-203

Natl. Inst. Stand. Technol. Spec. Publ. 500-203, 111 pages (July 1992)

CODEN: NSPUE2

U.S. GOVERNMENT PRINTING OFFICE

WASHINGTON: 1992

For sale by the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402
Table of Contents

1 INTRODUCTION 1

1 . 1 Background 1

1.2 Purpose 1

2 GLOSSARY of TERMS 3 2.1 Function 3 2.2 Variable 3 2.3 Literal 3 2.4 Numeric Literal 3

2 . 5 Nonnumeric Literal 3 2 . 6 Domain 3

2.7 Range 3 2.8 Integer 4

2.9 Noninteger 4

2.10 FXN 4

2.11 Verb 4

2.12 Standard Position 4

3 CONVENTIONS 4

3.1 Numbering System 4

3.2 Number of tests 5 3.3 References 5

4 REQUIREMENTS . 5 4.1 Functionality Tests 5 4.2 Intermediate Values 6 4.3 Expected Value 6 4.4 Error Margin 6 4.5 Angles Measurement 8 4.6 Statements Structure 8 4.7 Collating Sequence 8 4.8 Additional Information 8

5 TESTS DESCRIPTION 8 5.1 IFIOIA 8 5.2 IF102A 11

5.3 IF103A 13

5.4 IF104A 16

5.5 IF105A 19

5.6 IF106A 20

5.7 IF107A 23

5.8 IF108A 24

5.9 IF109A 26

5.10 IFllOA 28

5.11 IFlllA 29

5.12 IF112A 31

5.13 IF113A 33

5.14 IF114A 35

5.15 IF115A 37

5.16 IF116A 39

iii
5.17 IF117A 41

5.18 IF118A ...... 44

5.19 IF119A 46

5.20 IF120A 49

5.21 IF121A 52

5.22 IF122A 54

5.23 IF123A 57

5.24 IF124A 60

5.25 IF125A 62

5.26 IF126A 64

5.27 IF127A 68

5.28 IF128A 69

5.29 IF129A 71

5.30 IF130A 73

5.31 IF131A 76

5.32 IF132A 78

5.33 IF133A 80

5.34 IF134A 82

5.35 IF135A , 84

5.36 IF136A 87

5.37 IF137A 90

5.38 IF138A 93

5.39 IF139A 95

' 5.40 IF140A 98

5.41 IF141A 100

5.42 IF142A 102

6 ACKNOWLEDGMENTS 104

7 REFERENCES 105

iv
1 INTRODUCTION

1 . 1 Background

This document contains test specifications for the COBOL Intrinsic

Functions Module of the Federal Information Processing Standard (FIPS)

Programming Language COBOL, FIPS PUB 21-3 (ANSI X3. 23-1985, and Addendum

ANSI X3.23A-1989)

The testing of language processors to determine the degree to which they

conform to FIPS may be required by the Government departments and agencies

in accordance with the FIPS , the Federal Information Resources Management

Regulation (FIRMR) 201.13 and 201.39, and the associated Federal ADP and

Telecommunications Standards Index. As part of its mission, the Computer

Systems Laboratory (CSL) is responsible for providing language processor

validations for FIPS in support of Government departments' and agencies'

procurement requirements

.

A validation service has been established in fulfillment of this

responsibility. Results of validations, or validation certificates from

other validation organizations may be accepted as the basis for CSL

Certificate of Validation provided that all CSL requirements are met.

For Ada validations, CSL coordinates its validation responsibility with

the Department of Defense, Ada Joint Program Office (AJPO)

.

The CSL presently provides validation services for the following

languages

:

. Ada

. C

. COBOL

. Fortran

. MUMPS

. Pascal

. SQL

CSL is also working on future validation services for:

. BASIC

1.2 Purpose

This document serves as a reference manual and as a user's guide for the

COBOL Intrinsic Function Module Tests in the 1985 COBOL Compiler

Validation System (CCVS) . The tests are used by the National Institute

of Standards and Technology (NIST) to test COBOL implementations for

conformance to FIPS PUB 21-3, COBOL (ANSI X3. 23 -1985, and Addendvim ANSI

X3.23A-1989)

.

1
ANSI document number X3.23A-1989, "INTRINSIC FUNCTION ADDENDUM TO AMERICAN

NATIONAL STANDARD COBOL X3. 23-1985" proposed the incorporation of 42 new library functions into the standard. The functions are:

1) ACOS

2) ANNUITY

3) AS IN

4) ATAN

5) CHAR

6) COS

7) CURRENT -DATE

8) DATE-OF- INTEGER

9) DAY -OF -INTEGER

10) FACTORIAL

11) INTEGER

12) INTEGER -OF -DATE

13) INTEGER-OF-DAY

14) INTEGER- FART

15) LENGTH

16) LOG

17) LOGIC

18) LOWER-CASE

19) MAX

20) MEAN

21) MEDIAN

22) MIDRANGE

23) MIN

24) MOD

25) NUMVAL

26) NUMVAL-C

27) ORD

28) ORD-MAX

29) ORD -MIN

30) PRE SENT -VALUE

31) RANDOM

32) RANGE

33) REM

34) REVERSE

35) SIN

36) SQRT

37) STANDARD - DEVIATION

38) SUM

39) TAN

40) UPPER- CASE

41) VARIANCE

42) WHEN- COMPILED

This document is based on FIPS PUB 21-3. About 99% of the specifications

have been translated into COBOL code by the National Computer Center (NCC)

in England.

2
Tests are divided into two major categories' Simple Tests and Complex

Tests . A Simple test uses a single entity as the argument, i.e. , a constant or a literal by itself. Complex tests take as an argument

entities such as expressions or other Intrinsic Functions. The nature of

arguments for the Complex tests will most likely have an effect on the

accuracy of the expected value. This effect may be compensated by

allowing a greater error margin for such tests.

GLOSSARY of TERMS

Following is a list of terms used throughout the specifications

2 , 1 Ftmction A temporary data item whose value is

determined by invoking a mechanism provided

by the implementor at the time the function

is referenced during the execution of the

statement

.

2 . 2 Variable A data item whose value may be changed by

execution of the object program. A variable

used in an arithmetic-expression must be a numeric elementary item.

2 . 3 Literal A Character- string whose value is implied

by an ordered set of characters of which

the literal is composed or by specification

of a reserved word which references a figurative constant.

2.4 Numeric Literal A Character-string whose characters are selected from the digits '0' through '9',

the plus sign, the minus sign, and the

decimal point.

2.5 Nonnumeric Literal A Character-string delimited at the

beginning and at the end by the separator

quotation mark.

2 . 6 Domain The set of values that the function uses as input

.

2 . 7 Range The set of values that the function returns

based on the domain values

.

3
2 . 8 Integer A numeric literal or a numeric data item

that does not include any digit position to

the right of the assumed decimal point.

When the term 'integer' appears in general

formats, integer must not be a numeric data

item, and must not be signed, nor zero unless explicitly allowed by the rules of

that format.

2 . 9 Noninteger A numeric literal or numeric data item that

includes one or more digits to the right of

the assumed decimal point.

2.10 FXN

2 . 11 Verb

Function Name

A word that expresses an action to be taken

by a COBOL compiler or object program.

2.12 Standard Position The position of an angle with its vertex at

the origin of a rectangular-coordinate

system and its initial side coinciding with

the positive x-axes.

CONVENTIONS

3.1 Numbering System

Naming conventions in these specifications follow the conventions used in

the CCVS . A routine name consists of 6 characters whose meaning is as follows

:

First two Characters

Third Character

Fourth & Fifth Characters

Sixth Character

For example IF102A is the second of a series of several programs which

tests level 1 of the Intrinsic Functions module.

"IF" which identifies the

Intrinsic Functions module.

1 which identifies level 1 of

the IF module.

XX, A unique sequential number

that identifies each

one of the test programs.

"A" , which indicates that this

is an Automatic test.

4
3.2 Number of tests

The section labeled "Specific Features to be tested" (see sec. 5)

specifies which particular feature is to be tested. Only one test for each

specific feature is expected to be coded. The total number of tests is

756.

3 . 3 References

All page and section references in section 5 refers to ANSI X3.23A-1989.

4 REQUIREMENTS

4.1 Functionality Tests

All tests in these specifications are of a functional character. The main

purpose of the tests is to determine whether or not language processors

accept the standard syntax of Intrinsic Function- identifiers , and with

the specified arguments, produce implementation- defined return values

representative of correct implementation of the Intrinsic Function item.

To allow for differences in implementation- defined techniques in computing

the return values, a relative error of . 00002 or . 00004 in each direction

from the theoretically correct value is specified for most numeric or integer functions. The following formula illustrates that schema.

max-range = (return-value * 1.00002)

min-range = (return-value * 0.99998)

In some areas where the function is very unstable and it is increasing in

the vicinity of the argument the relative error is applied to the

arguments instead, as described by the following formula:

max-range = function (argument * 1.00002)

min-range = function(arg\iment * 0.99998)

The test report should list the range (maximum and minimum values) for the

expected answer. The test should be marked as "FAIL" if the computed

value is outside the specified error range of the expected answer.

In some cases, where relative error is not practical, an absolute error schema is used to compute the ranges as illustrated by the following

formula

:

max-range = (return-value + 0.00002)

min-range = (re turn-value - 0.00002)

5
The formulas presented above assume the value returned from the function

is positive. When the value is negative, the max-range and the min-range

are switched.

4.2 Intermediate Values

All intermediate values carry a precision of 10 decimal places for those

tests in which the argument is: 1) Not a single entity; 2) The function

is used with other functions (for numeric and integer functions only); and

3) The function is used as part of an expression (for numeric and integer

functions only) . It is recommended that implementors use 10 decimal

digits although it is not required by the standard.

4.3 Expected Value

The expected value holds a precision of 6 decimal places, with the

following exceptions:

1) IF136A - Simple Tests, subtest I, L: precision = 7 decimal

J - places

2) IF139A - Complex Tests, subtest K: precision = Z decimal places

Implementors are free to use a higher precision for the computed value on

all integer/numeric functions.

4.4 Error Margin

The expected relative error for the functions for which the standard

refers to its return value as an "approximation" is . 00002 for Simple

Tests and . 00004 for Complex Tests. A .00002 relative error is also

allowed for other numeric functions whose arguments involve the

calculation/manipulation of intermediate results and tests involving

fractional digits.

Those tests are:

1) ACQS

2) ANNUITY

3) ASIN

4) ATAN

5) COS

6) INTEGER (some tests)

7) INTEGER PART (some tests)

8 ) LOG

9) LOGIO

10) MAX (Complex tests and some Simple tests)

11) MEAN (Complex tests and some Simple tests)

12) MEDIAN (Complex tests and some Simple tests)

13) MIDRANGE (Complex tests and some Simple tests)

14) MIN (Complex tests and some Simple tests)

6
15) MOD (Complex tests)

16) NUMVAL (some tests)

17) NUMVAL-C (some tests)

18) PRESENT -VALUE

19) RANGE (Complex tests and some Simple tests)

20) REM (Complex tests and some Simple tests)

21) SIN

22) SQRT

23) STANDARD -DEVIATION

24) SUM (Complex tests and some Simple tests)

25) TAN

26) VARIANCE

Regardless of error considerations no error margin is allowed beyond the

range of the function.

The following functions do not allow any error margin for the expected

value

:

1) DATE -OF -INTEGER

2) DAY-OF- INTEGER

3) FACTORIAL

4) INTEGER (Tests not involving fractional digits)

5) INTEGER-OF-DATE

6) INTEGER -OF -DAY

7) INTEGER- PART (Tests not involving intermediate

arithmetic operations)

8) LENGTH

9) MAX (Simple Tests not involving fractional digits)

10) MEAN (Simple Tests not involving fractional digits)

11) MEDIAN (Simple Tests not involving fractional digits)

12) MIDRANGE (Simple Tests not involving fractional

digits)

13) MIN (Simple Tests not involving fractional digits)

14) MOD (Simple Tests not involving fractional digits)

15) NUMVAL (Tests not involving fractional digits)

16) NUMVAL-C (Tests not involving fractional digits)

17) ORD

18) ORD-MAX

19) ORD-MIN

20) RANGE (Simple Tests not involving fractional digits)

21) REM (Simple Tests not involving fractional digits)

22) SUM (Simple Tests not involving fractional digits)

The computed value for the following functions should be equal to, or lie

between, the specific limits given for that particular test.

1) CURRENT -DATE

2) CHAR

3) LOWER-CASE

4) RANDOM

5) REVERSE
6) UPPER- CASE

7) WHEN -COMPILED

4 . 5 Angles Measurement

All angle measures are given in radians, and all angles are assumed to be

in standard position.

4.6 Statements Structure

The PERFORM statement, where specified, should be used only as described

in section "E" of each test set as the statement involves looping, which

is different for each function depending on its range and domain.

4.7 Collating Sequence

The PROGRAM COLLATING SEQUENCE clause should be specified with an alphabet-name defined with the STANDARD -1 option for the MAX . MIN,

ORD-MAX . ORD-MIN . CHAR . ORD function test programs.

4.8 Additional Information

Additional information regarding arguments and returned values for the

functions described below can be found in document # X3.23A-1989.

5 TESTS DESCRIPTION

5 . 1 IFIOIA

a. Features Tested

This program tests the Intrinsic Function ACQS . which returns a numeric value in radians that approximates the arcosine of

argument-1. The type of this function is numeric. The valid domain

is -1 <= argl <= 1 and valid range is >=0 and <= Pi. The type of

argument-1 must be of class numeric. The returned value is the

approximation of the arccosine of argument-1.

FUNCTION ACOS (argl)

b. Reference

Page A- 33

Section 2.5

c. Number of tests

26

8
d. Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(10) VALUE 4

C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

PI PICTURE S9V9(17) VALUE 3.141592654

ARGl PICTURE S9V9(17) VALUE 0.00

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

must be used to test the features given below. Each type of

statement is to be allocated the first corresponding argument(s) in

the table and then all remaining arguments tested with the COMPUTE

statement where possible.

1) COMPUTE identifier-2 = arithmetic -expression1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition-1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL ACOS(argl) < 1

procedure -name -

1

argl = argl + .25

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which one of

its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic

Function.

Simple Tests (relative error = .00002)

Specific features to be tested | Arguments Expected

(argl) Answer

a) Z = 1 1 (1.0) |>= 0.000000

|<= 0.000020

b) Z = 1/2 1 (0.5) |>= 1.04718

|<= 1.04722

c) Z = 0 1 (0) |>= 1.57076

|<= 1.57082
d) rnL = - i

1 \

1 J . 1 A 1 Q

I j . 14165

e) Z = values close to 1

/ Q Q Q N

1 U U4q-Z / D

1 U

A / C 1 "7 A 045170

f ) Z = values close to 1/2 ( .4y) 1

r\ c o ^ o

1 i U5o 72

s) L = values close to 0 (. . uui; 1 \

1 ± joy /b

|<= 1 56982

h) z = values close to -1 1 (-.999) 3 09680

1 ^— QJ uy oy z i) z = a low magnitude non- 1 (A) |>= 1 57080

integer variable 1 ^

1 ^ 1 5 /UoD

j) Z = a low magnitude non- 1 (.00002) |>= 1 57074

integer constant i<= 1 57080

Complex Tests (relative error = .00004)

Specific features to be tested Arguments

(argl)

a) Z l/sqrt(2) 1 (l/sqrt(2)) |>= 0 785367

|<= 0 785429

b) Z sqrt(3)/2 | (sqrt(3)/2) |>= 0 523577

|<= 0 523619

c) Z expr. with value close to | ( 1 - 1.01) |>= 1 58073

or equal to 0 | i<= 1 58085

d) Z expr. with value close to | (1.98 / 2) 0 141533

or equal to 1 | i<= 0 141545

e) Z expr. with value close to

|

(0.2 + 0.29) i>= 1 05866

or equal to 1/2 | i<= 1 05874

f) Z expr. with value close to | (0.99 * -1) i>= 2 99993

or equal to -1 | i<= 3 00017

g) Z a subscripted variable | (IND(B) -2) i>=-0 00004

i<= 0 00004

h) Z a subscripted constant | (IND(5) / 9) i>= 0 679646

i<= 0 679700

i) Z an integer expression | (4 - 3) i>= 0 000000

using constants only | i<= 0 000040

j) Z an integer expression | (C / C) i>= 0 000000

using variables only | i<= 0 000004

k) Z a non- integer expression | (0.25 * 1) i>= 1 31806

using constants only | i<= 1 31816

1) Z an integer expression | ((D / D) - 1) 1 >= 1 57073

using constants and | i<= 1 57085

and variables \ m) Z a non- integer expression | (PI - 4) i>= 2 60285

using variables and | i<= 2 60305

constants 1

Expected

Answer

10
n) ACOS function used recursively i.e. , ACOS (ACOS (X)))

,

where X may be a variable

and/or an expression

o) The function ACOS applied

twice within an expression

TEMP=ACOS (ACOS (D/D)

)

TEMP=ACOS ( D/D ) +ACOS ( D/D

)

TEMP: >= 1.57073

1.57085

TEMP: >= 0.000000

<= 0.000040

5.2 IF102A

a. Features Tested

This program tests the Intrinsic Function ANNUITY , which returns a numeric value that approximates the ratio of an annuity paid at the

end of each period for the number of periods specified by argument2

to an initial investment of one. Interest is earned at the rate

specified by argument-1 and it is applied at the end of the period,

before the payment. The type of this function is numeric.

Argument-1 must be of class numeric. The returned value depends on

the value of argument-1 as follows:

if argl = 0:

1 / arg2

if argl <> 0:

argl / (1 - (1 + argl) (- arg2))

Argl = interest rate and must be a value >= 0.

Arg2 = number of periods and must be a positive integer.

FUNCTION ANNUITY (argl arg2)

b. Reference

Page A- 34

Section 2.6

c. Number of tests

13

d. Variables

A PICTURE S9(10) VALUE 4

B PICTURE S9(5)V9(5) VALUE .25

C PICTURE S9(10) VALUE 10

D PICTURE S9(10) VALUE 100

11
ARG2 PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION ANNUITY(0, arg2) < .25

procedure -name -

1

arg2 = arg2 + 1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested 1 Arguments Expected

1 (argl) Answer

a) argl = 0; arg2 = const 1 (0, 4) |>= 0 249995

|<= 0 250005

b) argl == non- integer const 1 (2.9, 4) j>= 2 91252

|<= 2 91264

c) argl = non- integer const 1 (.09, A) 0 308663

|<= 0 308675

d) argl = non- integer var 1 (B, 2) |>= 0 694430

|<= 0 694458

e) argl = non- integer var 1 (B, 4) 1 >= 0 423434

i<= 0 423450

f) argl = integer var 1 (A, 9) i>= 3 99992

i<= 4 00008

12
g) argl = integer const

h) argl, arg2 subscripted values

(5, 5)

(IND(l), IND(A))

|>= 5.00054

|<-= 5.00074

|>= 4.03217

|<= 4.03233

Complex Tests (relative error = .00004)

Sp ecific features to be tested | Arguments 1 Expected

Carel") 1 Answer

a) argl = expr with vars , consts| (B / 2, 8) |>= 0 204824

arg2 = constant |<= 0 204840

b) ANNUITY function that TEMP=ANNUI TY ( ANNUI TY ( 0

,

Item?

invokes itself 3), 3)) |>= 0 576553

|<= 0 576599

c) ANNUITY function used as 1 TEMP=ANNUITY(0,2) + 5 Item?

part of an expression |>= 4 49978

d) ANNUITY function used twice 1 |<= 5 50022

within an expression TEMP=ANNUITY(0,2)+ |TEMP

ANNUITY(0,2) 999960

l<= 1 00004

5 . 3 IF103A

a. Features Tested

This program tests the Intrinsic Function ASIN . which returns a numeric value in radians that approximates the arcsine of argumentl

.

The type of this function is numeric. The valid domain is -1 <=

argl <= 1. and range is >= -Pi/2 and <= +Pi/2 . Argument- 1 must be

of class numeric. The returned value is the approximation of the

arcsine of argument- 1.

FUNCTION ASIN (argl)

b. Reference

Page A- 35

Section 2.7

b. Number of tests

27

c. Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(10) VALUE 2

13
C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

PI PICTURE S9V9(17) VALUE 3.141592654

ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

d. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement - 2 4) PERFORM procedure -name -1 UNTIL FUNCTION ASIN(argl) < 0

procedure -name -

1

argl = argl - .25

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression

containing arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested 1 Arguments

1 (argl)

Expected

Answer

a) Z = 1 1 (1.0) |>= 1.57076

|<= 1.57080

b) Z = 1/2 1 (0.5) |>= 0.523588

i<= 0.523609

c) Z = 0 1 (0) l>= -0.000020

l<= 0.000020

d) Z = -1 1 (-1) l>= -1.57080

l<= -1.57076

e) Z = values close to 1 1 ( .999) l>= 1.52563

l<= 1.52652

14
•FN "7Z. = values Close co i/z 1 >TM u

.

CI 0 m

Q

J izu /

y

1 <= U . Q 1 o A n n

Z. — 1/9 1 \ ^ ->

)

1 \

1 — - nu J Z J uuy

1 ^ - u

C 0 T c Q Q JZ J JOO

n) "7 — values Close to -i / . aqq

N

1 -

1

J Z b J Z

1 ^ - i

Q 0 c; ^ Q JZ Do J

"7Z. — PT //i A\J Q A 0 O 0 T y u J J z i |<= 0 903357

j) z = -PI/4 1 (-PI/4) |>= -0 903357

|<= -0 903321

k) z = a variable subscripted 1 (IND(B)) |>= -0 000020

variable j<= 0 000020

Complex Tests (relative error = .00004)

Specific features to be tested 1 Arguments 1

L

Expected

Answer

a) z. l/sqrt(2) (l/sart( 2)

)

Au

.

7 8 ^; 7 / O J J D /

I <= n

Z. sqrt(3)/2 f sort fS") /2')

1 1

J- . <= 1

.

04723

c Z expr. with value close to 1 (-0.2 + -0 . 29) I >=-0. 512110

or equal to -1/2 I <=0 512069

d) z expr. with value close to 1 (1.98 / 2) l>= 1 42919

or equal to 1 l<= 1 42931

e) z expr. with value close to 1 (0.2 + 0.29) 0 512069

or equal to 1/2 l<= 0 512110

f) z expr. with value close to 1 (0.99 * -1) l>= -1 42931

or equal to -1 l<= -1 42919

g) z a constant subscripted | (IND(3) / 8) l>= 0 675104

variable l<= 0 675158

h) z an integer expression | (4 - 3) l>= 1 57073

using constants only 1 l<= 1 57080

i) z an integer expression | (C - C) l>= -0 000040

using variables only 1 l<= 0 .000040

j) z a non- integer expression | (0.25 * 1) l>= 0 .252670

using constants only 1 l<= 0 .252690

k) z a non- integer expression | (1 / PI) l>= 0 .323933

using variables only 1 l<= 0 .323959

1) z an integer expression | ((D / D) - 1) l>= -0 .000040

using constants and 1 l<= 0 .000040

variables

m) z a non- integer expression | (PI - 4) i>= -1 .03219

using variables and 1 i<= -1 .03211

constants

15
n) ASIN function used recursively i.e. , ASIN(ASIN(X)))

,

where X may be a variable

and/or expression

TEMP = ASIN(ASIN(PI-3)) TEMP: >= 0.142546

<= 0.142558

o) The function ASIN used

twice within an expression

TEMP = ASIN( .6) + ASIN( .6)

TEMP: >= 1.28695 <= 1.28705

5.4 IF104A

a. Features Tested

This program tests the Intrinsic Function ATAN . which returns a numeric value in radians that approximates the arctangent of

argument- 1. The type of this function is numeric. The valid range

is > -Pi/2 and < +Pi/2. Argument-1 must be of numeric class. The

returned value is the approximation of the arctangent of argument-1.

FUNCTION ATAN (argl)

b. Reference

Page A- 36

Section 2.8

c. Number of tests

27

d Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(10) VALUE 2 C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

PI PICTURE S9V9(17) VALUE 3.141592654

ARGl PICTURE S9V9(17) VALUE 1.00

SQRT3 PICTURE S9V9(17) VALUE 1.732050808

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(5)V9(5)

16
e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE express ion- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement -2

4) PERFORM procedure -name -1 UNTIL FUNCTION ATAN(argl) < 0

procedure -name -

1

argl = argl - . 25

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which one of the operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested | Arguments

(argl)

Expected

Answer

a) Z 1 1 (1.0) |>= 0 785382

[<= 0 785414

b) Z 1/2 1 (0.5) |>= 0 463638

|<= 0 463656

c) Z 0 1 (0) 1 >= -0 000020

1<= 0 000020

d) Z -1 1 (-1) |>= -0 785414

|<= -0 785382

e) Z values close to 1 | ( .999) 1 0 784881

|<= 0 784913

f) z values close to 0 | ( .049) |>= 0 048959

|<= 0 048961

g) z a low magnitude non- | (A) -0 000040

integer variable | |<= -0 000039

h) Z a low magnitude non- | ( .00002) |>= 0 000019

integer constant | i<= 0 .000020

i) Z a subscripted constant | (IND(B)) i>= -0 .000020

i<= 0 .000020

17
Complex Tests (relative error = .00004)

Specific features to be tested | Arguments

(argl)

1

1

1

Expected

Answer

a) Z = l/sqrt(3) 1 (l/sqrt(3)) |>= 0. 523577

|<= 0. 523619

b) Z = sqrt(3) 1 (sqrt(3)) |>= 1. 04715

|<= 1. 04723

c) z = values close to sqrt(3) | (SQRT3 - .001) |>= 1. 04690

|<= 1. 04698

d) z = values close to l/sqrt(3)

|

((1 / SQRT3) - 001) l>= 0. 522827

|<= 0. 522869

e) z = expr. with value close to

j

( 1 - 1.01) !>=0. 010000

or equal to 0 | |<=--0. 009998

f) z = expr. with value close to

|

(1.98 / 2) l>= 0. 780342

or equal to 1 | |<= 0. 780404

g) z = expr. with value close to

|

(SQRT3 + .01) |>= 1. 04964

or equal to sqrt(3) | |<= 1. 04972

h) z = expr. with value close to

|

((1 / SQRT3) + 01) i>= 0. 531045

or equal to l/sqrt(3) | l<= 0. 531087

i) z = a subscripted variable | (IND(3)/B) 1 >= 1. 19023

l<= 1 19033

j) z = an integer expression | (4 - 3) l>= 0 785367

using constants only | l<= 0 785429

k) z = an integer expression | (C - C) l>= -0 000040

using variables only | j<= 0 000040

1) z = a non- integer expression | (0.25 * 1) l>= 0 244968

using constants only | l<= 0 244988

m) z = a non- integer expression | (1 / PI) i>= 0 308157

using variables only | i<= 0 308181

n) z = an integer expression | ((D / D)- 1) i>= -0 000040

using constants and | i<= 0 000040

and variables | o) z = a non- integer expression | (PI - 4) i>= -0 709382

using variables and | i<= -0 709326

constants | P) ATAN function used recusive- | TEMP=ATAN(ATAN(PI/5)

)

|TEMP

ly i.e., ATAN (ATAN (X) ) , where] |>= 0 .511215

X may be a variable and/or | |<= 0 .511255 an expression | q) The function ATAN used | TEMP = ATAN( .6) + |TEMP

twice within an expression | ATAN ( - . 6

)

1 >= -0 .000040

|<= 0 .000040

18
IF105A

a. Features Tested

This program tests the Intrinsic Function CHAR , which returns a one -character alphanumeric value that is a character in the program

collating sequence having the ordinal position equal to the value

of argument- 1. The type of this function is alphanumeric.

Argument-1 must be an integer, whose value must be greater than zero and less than or equal to the number of positions in the collating

sequence

FUNCTION CHAR (argl)

b. Reference

Page A- 37

Section 2.9

c. Number of tests

8

d. Variables

B PICTURE S9(10) VALUE 37

C PICTURE S9(10) VALUE 2 D PICTURE S9(10) VALUE 100

ARR VALUE "066037100070044"

IND OCCURS 5 TIMES PICTURE 9(3)

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument(s) in the table and then all

remaining arguments tested with the MOVE statement where possible.

1) MOVE identifier-1 TO identifier-2

2) IF condition- 1 THEN

statement

ELSE

statement -2

Identifier-1 refers to a function invocation.

Identifier-2 must never be used as a function invocation.

Condition- 1 refers to a conditional expression for which one of

its operands is an Intrinsic Function.

19
Spe cific features to be tested 1 Arguments

1 (argl)

1 Expected

1 Answer

a) Z = an integer constant 1 (37) 1 $

b) Z = an integer variable 1 (B) 1 $

c) Z = a subscripted integer

constant

1 (IND(5))

1

1 +

1 d) Z = a subscripted integer

variable

1 (IND(C)) 1 $

e) Z = an integer constant 1 (87) 1 V

f) Z = an integer variable 1 (D) 1 c

g) a CHAR function used with 1 TEMP = 0RD(CHAR(2)) |TEMP = 2 another function

h) a CHAR function used twice

within an expression

1 TEMP = 0RD(CHAR(4))+

1 0RD(CHAR(7))

|TEMP = 11

5.6 IF106A

a. Features Tested

This program tests the Intrinsic Function COS . which returns a numeric value that approximates the cosine of an angle or arc expressed in radians, that is specified by argument- 1. The type of

this function is numeric. The valid range is: -1<= COS(argl)< =1

.

Argument -1 must be class numeric. The returned value is the

approximation of the cosine of argument- 1.

FUNCTION COS (argl)

b. Reference

Page A- 38

Section 2.10

c. Number of tests

32

d. Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(5)V9(5) VALUE 14000.105

C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

E PICTURE S9(10) VALUE 3 PI PICTURE S9V9(17) VALUE 3.141592654

ARGl PICTURE S9V9(17) VALUE 1.00

20
ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition-1 THEN

statement-1

ELSE

statement2

4) PERFORM procedure-name-1 UNTIL FUNCTION COS(argl) < 0

procedure -name -

1

argl = argl - .25

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested | Arguments

(argl)

Expected

Answer

a) Z = 0 1 (0) |>= 0 999980

|<= 1 00000

b) Z = PI 1 (PI) 1 00000

i<=- 0 999980

c) Z = -PI 1 (-PI) 1 00000

i<=- 0 999980

(0.001) i>= 0 999980

d) Z = Values close to 0 | i<= 1 000000

e) Z = a low magnitude non- | ( .00009) 1 >= 0 999980

integer constant | i<= 1 000000

( const < .0001 ) 1 f) z = a low magnitude non- | (A) 0 99998

integer variable | i<= 1 00000

( var < .0001 ) |

21
g) Z = a variable subscripted

variable

h) Z = a constant subscripted

variable

(IND(E))

(IND(5))

>= 0.283656 <= 0.283668 >= 0.753887 <= 0.753917

Complex Tests (relative error = .00004)

Specific features to be tested Arguments

(argl)

a) Z = PI/3 1 (PI / 3) |>= <=

0.

0

,

499980

500020 V \y \J t— \J b) Z = PI/2 1 (PI / 2) |>=-

1

0.

0.

000040

000040

c) z 3PI/2 1 (3 * PI)/2 |>=-

1

0.

0.

000040

000040

d) z = -PI/3 1 (-PI / 3)

1

0.

0.

499980

500002

e) z = -PI/2 1 (-PI / 2) |>=-

1

0.

0

.

000040

000040 V \j \j f) z -3PI/2 1 (3 * -PI)/ 2 |>=-

1 0.

0

000040

000040

g) z = Values close to PI/2 | (PI/2)-0.001 |>=

|<=

0

0

000937

001063

h) z Values close to PI/3 ((PI/3) + 0.001)

|<=

0

0

499113

499153

i) z Values close to 3PI/2 | ((3 * PI)/ 2) + 0.001 |>=

|<=

0

0

000811

001189

j) z = Expr. with value close | (PI * (4 - 2) / 180) |>=

1

0

0

999350

999430

k) z Expr. with value close

to or equal to PI/2

(PI / 2) - (PI / 180) |>=

|<=

0

0

.017451

.017453

1) z Expr. with value close

to or equal to PI/3

(PI / 3) - (PI / 180)

|<=

0

0

.515017

.515059

m) z Expr. with value close

to or equal to PI

(PI + ( PI / 180)) |>=

|<=

-0

-0

.999887

.999807

n) z Expr. with value close

to or equal to 3PI/2

((PI * 272) / 180) |>=

|<=

0

0

.034898

.034900

o) z an integer expression

using constants only

(4 / 2) i>=

i<=

-0

-0

.416163

.416129

P) z a non- integer

expression using

constants only

(3 / 2) i>=

i<=

0

0

.070734

.070740

q) z a non- integer expression

using variables only

(PI - A) i>=

i<=

-1

-0

.000000

.999960

r) z an integer expression

using variables and

constants

(D / 100) i>=

i<=

-0

-0

.839105

.839037

Expected

Answer

22
s) Z = a non- integer

expression using

variables & constants

t) Z = Values close to PI

u) COS used as part of an expression

v) COS function used recursively i.e., COS(COS(X)), where

X may be a variable or an expression

w) The COS function used

twice within an expression

(PI / 180)

(PI - 0.001)

TEMP = COS (PI) + 1

TEMP = COS (COS (2))

TEMP = COS(PI)+COS(PI)

>= 0.999807

<= 0.999887

>=- 1.000000

<=-0. 999960

TEMP:

>=-0. 000040

<= 0.000040

TEMP: >= 0.914616

<= 0.914690

TEMP:

>=-2 .00008

<=-l. 99992

5 . 7 IF107A

a. Features Tested

This program tests the Intrinsic Function CURRENT - DATE . which

returns 21-character alphanumeric value that represents the calendar

date, time of day and local time differential factor provided by the

system on which the function is evaluated. The type of this

function is alphanumeric. For additional information related to the

returned values see pages A-39 & A-40 of X3.23A-1989, "INTRINSIC

FUNCTION MODULE ADDENDUM TO AMERICAN NATIONAL STANDARD COBOL,

X3. 23-1985.

FUNCTION CURRENT -DATE

b. Reference

Page A-39

Section 2.11

c. Number of tests

2

d. Variables

TEMPI PICTURE X(21)

TEMP2 PICTURE X(21)

e. Statement structure

At least one the following COBOL statements must be used to te^t the

features given below. Each type of statement is to be allocated the

first corresponding argument(s) in the table and then all remaining

23
arguments tested with the MOVE statement where possible.

1) MOVE identifier- 1 TO identifier-2

2) IF condition- 1 THEN

statement1

ELSE

statement2

Identifier- 1 refers to a function invocation.

Identifier-2 must never be used as a function invocation.

Condition- 1 refers to a conditional expression for which one of

its operands is an Intrinsic Function.

Specific features to be tested | Arguments 1 Expected

1 Answer

a) check that the range is valid

|

TEMPI = CURRENT

DATE

b) check again and make sure | TEMP2 = CURRENT

DATE 1 TEMP2=>TEMP1

values are close, with a | small time differential | between function calls and | second call returns a time | later than first call |

5.8 IF108A

a. Features Tested

This program tests the Intrinsic Function DATE -OF- INTEGER , which

converts a date in the Gregorian calendar from integer date form to

standard date form (YYYYMMDD) . The type of this function is

integer. The argument given must be a positive integer that

corresponds to the number of days past December 31, 1600 in the

Gregorian calendar. The returned value represents the ISO standard

date equivalent of the integer specified in argument- 1. The

returned value is in the form (YYYYMMDD) , where YYYY represents a year in the Gregorian calendar, MM represents the month of that year

and DD represents the day of that month.

FUNCTION DATE-OF- INTEGER (argl)

b. Reference

Page A-41

Section 2.12

24
Number of tests

10

d. Variables

A PICTURE S9(10) VALUE 400

C PICTURE S9(10) VALUE 300

D PICTURE S9(10) VALUE 1 ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition-1 THEN

statement1

ELSE

statement-2

4) PERFORM procedure -name -1 UNTIL FUNCTION

DATE-OF-INTEGER(argl) > 16010110

procedure -name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested

a) Z = an integer constant

b) Z = an integer variable

c) Z = a constant subscripted

integer variable

d) Z = a variable subscripted

integer variable

Arguments

(argl)

(1)

(A)

(IND 1))

(IND(D))

Expected

Answer

16010101

16020204

16010104

16010104

25
e) Z = an integer that is

exactly equal to 365*2,

two years

f) Z = an integer variable

g) Z = an integer that is

exactly equal to 365

h) DATE -OF -INTEGER function used

as part of an expression

i) DATE -OF -INTEGER function used

twice within an expression

(730)

(C)

(365)

TEMP = DATE -OF -INTEGER

(D) + 10

TEMP = DATE -OF- INTEGER

( D) + DATE-OF- INTEGER

(D)

16021231

16011027

16011231

TEMP = 16010111

TEMP = 32020202

IF109A

a. Features tested

This program tests the Intrinsic Function DAY -OF -INTEGER , which

converts a date in the Gregorian calendar from integer date form to

Julian date form (YYYYDDD) . The type of this function is integer.

The argument must be a positive integer that corresponds to the

number of days past December 31, 1600 in the Gregorian calendar.

The returned value represents the Julian equivalent of the integer

specified in argument- 1. The returned value is in the form

(YYYYDDD) where YYYY represents a year in the Gregorian calendar and

DDD represents the day of that year.

FUNCTION DAY- OF- INTEGER (argl)

b. Reference

Page A-42

Section 2.13

c. Nvxmber of tests

8

d. Variables

A PICTURE S9(10) VALUE 400

C PICTURE S9(10) VALUE 365

D PICTURE S9(10) VALUE 1

ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

26
e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition-1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION

DAY-OF-INTEGER(argl) > 1601010

procedure -name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic

Function.

Specific features to be tested | Arguments

(argl)

Expected

Answer

a) Z = an integer constant (1) 1601001

b) Z = an integer variable (A) 1602035

c) Z = a subscripted integer (IND(l)) 1601004

constant

d) Z = a subscripted integer (IND(D)) 1601004

variable

e) Z = an integer equals to the (C) 1601365

number of days in one year

f) DAY- OF -INTEGER function used TEMP = DAY -OF

INTEGER(D)

|

TEMP =

as part of an expression + 10 1601011

g) DAY-OF- INTEGER function used TEMP = DAY -OF

INTEGER(D)

[

TEMP = twice within an expression +DAY-OF-INTEGER(D) | 3202002

27
5 . 10 IFllOA

a. Features Tested

This program tests the Intrinsic Function FACTORIAL , which returns

an integer that is the factorial of argument- 1. The type of this

function is integer. Argument- 1 must be an integer greater than or equal to zero. If the value of argument- 1 is zero, the value 1 is

returned. If the value of argument- 1 is positive, its factorial is

returned.

FUNCTION FACTORIAL (argl)

b. Reference

Page A-43

Section 2.14

c. Number of tests

9

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement -1

ELSE

statement2

4) PERFORM procedure-name- 1 UNTIL FUNCTION FACTORIAL (argl) >

120

procedure -name -

1

argl = argl + 1

28
Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested 1 fiLgumencs 1 Expected

1 (argl) 1 Answer

a) Z = 0 1 \^

)

1 1

1 i. b) Z = an integer constant 1 (3) 1 6

c) Z == an integer variable 1 (A) 1 120

d) Z = a subscripted integer

constant

1 (IND(4)) i 6

e) Z = a subscripted integer

variable

1 (IND(A)) 1 5040

f) a FACTORIAL function that

invokes itself

1 TEMP = FACTORIAL(

1 FACT0RIAL(3))

1 TEMP = 720

g) a FACTORIAL function used

as part of an expression

1 TEMP = FACT0RIAL(1)+B 1 TEMP = 8

h) a FACTORIAL function used

twice within an expression

1 TEMP = FACT0RIAL(4) +

1 FACT0RIAL(2)

1 TEMP = 26

5.11 IFlllA

a. Features Tested

This program tests the Intrinsic Function INTEGER, which returns

the greatest integer value that is less than or equal to the

argument. The type of this function is integer. Argument- 1 must

be of class numeric.

FUNCTION INTEGER (argl)

b. Reference

Page A-44

Section 2.15

c. Number of tests

24

d. Variables

A PICTURE S9(10) VALUE 500000

B PICTURE S9(10) VALUE 1

29
E PICTURE S9(6)V9(5) VALUE 399999.122

F PICTURE S9(5)V9(5) VALUE 0.00032

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE -5

I PICTURE S9(5)V9(5) VALUE 3.4

ARGl PICTURE S9(5)V9(5) VALUE 4.4

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier -2 = arithmetic- expression1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition- 1 THEN

statement1

ELSE

statement -2

4) PERFORM procedure- name -1 UNTIL FUNCTION INTEGER(argl) < 0

procedure -name -

1

argl = argl - 1

Identifier- 2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be | Arguments 1 Expected

tested (argl) 1 Answer

a) Z = 0 1 (0) 1 0

b) Z = positive integer constant] (3) 1 3 c) Z = positive non- integer | constant |

(4.578) 1 4

d) Z = negative integer constant] (-58) 1 -58

e) Z = negative non- integer j constant |

(-9.763) 1 -10

f) z = a large magnitude integer]

constant j

(320485) 1 320485

g) z = a large magnitude non- ] integer constant )

(230492.4828) 1 230492

30
h) Z a low magnitude non- | integer constant | (0.00032) 1 0

i) z a large magnitude integer

|

variable |

(A) 1 500000

j) z = a large magnitude non- | integer variable |

(E) 1 399999

k) z a low magnitude integer | variable |

(B) 1 1

1) z a low magnitude non- | integer variable |

(F) 1 0

m) z = a constant subscripted | variable |

(IND(2)) 1 0

n) z = a variable subscripted | variable |(IND(B)) 1 ^

o) z = an integer expression | using constants only |

((6/3) + 9) 1 11

P) z = an integer expression | using variables only |

(H + B) 1

q) z = a non- integer expression | using constants only |

(6.3 - 4.2/2) 1 ^

^) z a non- integer expression | using variables only |

((H + G) * I) 1

s

)

z an integer expression | using variables and | constants |

(H / 5) 1 -1

t) z low-magnitude negative | (-0.0000001) 1 -1 non- integer constant

INTEGER used as part of an expression

INTEGER function that

invokes itself

The INTEGER function

applied twice on an expression

TEMP = INTEGER(3.2)+I

TEMP = INTEGER( INTEGER

(1.6))

TEMP = INTEGER(1.2)

+ INTEGER(1.6)

TEMP: >= 6.39987 <= 6.40013

TEMP = 1

TEMP = 2

5.12 IF112A

a. Features Tested

This program tests the Intrinsic Function INTEGER-OF-DATE . which

converts a date in the Gregorian calendar from standard date form

(YYYYMMDD) to integer date form. The type of this function is

integer. Argument -1 must be an integer of the form YYYYMMDD, where:

a) YYYY - represents the year in the Gregorian calendar. It

must be an integer greater than 1600.

b) MM - represents a month and must be a positive integer

less than 13.

31
c) DD - represents a day and must be a positive integer less

than 32 provided that it is valid for the specified month

& year combination.

The returned value is an integer that is the number of days the date

represented by argument -1 succeeds December 31, 1600, in the

Gregorian calendar.

FUNCTION INTEGER -OF -DATE (argl)

b. Reference

Page A-45

Section 2.16

c. Number of tests

8

d. Variables

A PICTURE S9(10) VALUE

D PICTURE S9(10) VALUE

ARGl PICTURE S9(10) VALUE

ARR VALUE

16020204

216010101

"1601010116020210"

IND OCCURS 2 TIMES PICTURE 9(8)

TEMP PICTURE S9(10)

Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION

INTEGER-OF-DATE(argl) > 10

procedure name-1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

32
Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested Arguments Expected

(argl) Answer

a) Z = an integer constant (16010101) 1 b) Z = an integer variable (A) 400

c) Z = a subscripted integer

constant

(IND(l)) 1

d) Z = a subscripted integer

variable

(IND(D)) 406

e) Z = an integer equals to one year after December 31

1600

(16011231) 365

f) INTEGER -OF -DATE function

used as part of an expression

TEMP=INTEGER- OF - DATE ( A) + 10

TEMP=410

g) INTEGER -OF -DATE function

used twice within an expression

TEMP=INTEGER-OF-DATE(A)

+ INTEGER-OF-DATE(A)

1 TEMP=800

5.13 IF113A

a. Features Tested

This program tests the Intrinsic Function INTEGER -OF -DAY , which

converts a date in the Gregorian calendar year from Julian date form

(YYYYDDD) to integer date form. The type of this function is

integer. Argument- 1 must be an integer of the form YYYYDDD where:

a) YYYY - represents the year in the Gregorian calendar. It

must be an integer greater than 1600.

b) DDD - represents the day of the year. It must be an integer less than 367 provided that is valid for the year

specified.

The returned value is an integer that is the number of days the date

represented by argument- 1 succeeds December 31, 1600, in the

Gregorian calendar.

FUNCTION INTEGER -OF -DAY (argl)

b . Reference

Page A-46

Section 2.17

33
c. Number of tests

8

d. Variables

A PICTURE S9(10) VALUE 1602035

D PICTURE S9(10) VALUE 2 ARGl PICTURE S9(10) VALUE 1601001

ARR VALUE "16010011602035"

IND OCCURS 2 TIMES PICTURE 9(7)

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement1

ELSE

statement -2

4) PERFORM procedure -name -1 UNTIL FUNCTION

INTEGER-OF-DAY(argl) > 10

procedure - name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested | Arguments | Expected

I (argl) I Answer

a) Z = an integer constant | (1601001) | 1 b) Z = an integer variable | (A) | 400

c) Z = a constant subscripted ] (IND(l)) | 1 integer variable | | d) Z = a variable subscripted j (IND(D)) | 400

integer variable | |

34
e) Z = an integer that is equal

to the number of days

after one year past

December 31, 1600

f) INTEGER -OF -DAY function used

as part of an expression

g) INTEGER -OF -DAY function used

twice within an expression

(1601365)

TEMP= INTEGER-OF-DAY(A)

+ 10

TEMP = INTEGER-OF-DAY(A)

+ INTEGER-OF-DAY(A)

365

TEMP

410

TEMP

800

5.14 IF114A

a. Features Tested

This program tests the Intrinsic Function INTEGER- PART . which

returns an integer that is the integer portion of argument- 1. The

type of this function is integer. Argument- 1 must be class numeric.

If the value of argument- 1 is zero, the returned value is zero. If

the value of argument -1 is positive, the returned value is the

greatest integer less than or equal to the value of argument- 1. If

the value of argument- 1 is negative, the returned value is the least

integer greater than or equal to the value of argument-1.

FUNCTION INTEGER- PART (argl)

b. Reference

Page A-47

Section 2.18

c. Number of tests

24

d. Variables

A PICTURE S9(10) VALUE 500000

B PICTURE S9(10) VALUE 1 E PICTURE S9(5)V9(5) VALUE 399999.122

F PICTURE S9(5)V9(5) VALUE 0.00032

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE -5

I PICTURE S9(5)V9(5) VALUE 3.4

ARGl PICTURE S9(5)V9(5) VALUE 4.4

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

35
e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION

INTEGER- PART (argl) < 0

procedure -name -

1

argl = argl - 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested Argioments

(argl)

a) Z 0 1 (0) 1 0

b) Z positive integer constant] (3) 1 3

c) z positive non- integer | constant |(4.578) 1 ^

d) z negative integer constant] (-58) 1 -58

e) z negative non- integer | constant j

(-9.763) 1 -9

f) z a large magnitude integer]

constant ]

(320485) ] 320485

g) z a large magnitude non- ] integer constant |

(230492.4828) 1 230492

h) z a low magnitude non- ] integer constant ](0.00032) 1 0

i) z a large magnitude integer]

variable ]

(A) ] 500000

j) z a large magnitude non- ] integer variable ]

(E) ] 399999

k) z a low magnitude integer ] variable ]

(B) 1 1

Expected

Answer

36
1) Z = a low magnitude non- integer variable

m) Z = a subscripted constant

n) Z = a subscripted variable

o) Z = an integer expression

using constants only

p) Z = an integer expression

using variables only

q) Z = a non-integer expression

using constants only

r) Z = a non- integer expression

using variables only

s) Z = an integer expression

using variables and

constants

t) Z = a low-magnitude negative

non- integer constant

u) INTEGER- PART used as part

of an expression

v) INTEGER- PART function that

invokes itself

w) The INTEGER- PART function

applied twice on an expression

(F) 1 0

(IND(l)) I 4

(IND(B)) I 4

((6/3) +9) I 11

(H + B) I -4

(6.3 - (4.2/2)) I 4

((H + G) * I) I -3

(H / 5) I -1

(-0.0001) I 0

TEMP=INTEGER-PART(3.2) 1 TEMP

+ I |>= 6.39987

|<= 6.40013

TEMP=INTEGER-PART( j TEMP = 3 INTEGER-PART(3.2)) | TEMP=INTEGER-PART(3.2)+ j TEMP = 4

INTEGER -PART (1.3) |

5.15 IF115A

a. Features Tested

This program tests the Intrinsic Function LENGTH . which returns an integer equal to the length of the argument in character positions,

the type of the function is integer. Argument- 1 may be a nonnumerical literal or a data item of any class or category. For

additional information related to arguments and returned values see page A-48 of X3.23A-1989, "INTRINSIC FUNCTION MODULE ADDENDUM TO

AMERICAN NATIONAL STANDARD COBOL, X3. 23-1985."

FUNCTION LENGTH (argl)

b. Reference

Page A-48

Section 2.19

c. Number of tests

8

37
d. Variables

K PICTURE A(l) VALUE "D"

M PICTURE A(17) VALUE "longstringofchars"

N PICTURE A(3) VALUE "abc"

C PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument (s) in the table and then all

remaining arguments tested with the COMPUTE statement where

possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested Arguments | Expected

(argl) 1 Answer

a) Z = constant string of 1 character

("A") 1 1

b) Z = constant string with a large number of

characters

("ABCDEFGHIJKLMNOPQRST")

|

20

c) Z = constant string with a low number of characters

("ABCD") 1 4

d) Z = variable string of 1 character

(K) 1 1

e) z = variable string with a large number of

characters

(M) 1 17

f) z = variable string with a low number of characters

(N) 1 3

g) the

as LENGTH function usedpart of an expression

C = LENGTH (N) + 2* | C = 5

h) the LENGTH function used C = LENGTH(N) + | C = 6

twice within an expression LENGTH (N) |

38
5.16 IF116A

a. Features Tested

This program tests the Intrinsic Function LOG, which returns a numeric value that approximates the logarithm to the base e (natural

log) of argument- 1. The type of this function is numeric.

Argument-1 must be class numeric and must be greater than zero. The

returned value is the approximation of the logarithm to the base e of argument-1.

FUNCTION LOG (argl)

b. Reference

Page A-49

Section 2.20

c. Number of tests

26

d. Variables

PICTURE

PICTURE

PICTURE

PICTURE

PICTURE

PICTURE

PICTURE

PICTURE

S9(10)

S9(10)

S9(10)

S9(10)

S9(1)V9(9)

S9(5)V9(5)

S9(5)V9(5)

S9(5)V9(5)

VALUE

VALUE

VALUE

VALUE

VALUE

VALUE

VALUE

VALUE

VALUE

VALUE

ARGl PICTURE S9(5)V9(5)

ARR

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

600000

7 -4

10

2.718281828

32000.8

.00002

-5.3

1.00

"40537"

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

39
3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION LOG(argl) > 1

procedure -name -

1

argl = argl + .

2

Identifier- 2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested | Arguments

(argl)

Expected

Answer

a) Z e 1 (E) |>= 0. 999980

|<= 1. 00002

b) Z 1 1 (1) |>= -0. 000020

|<= 0. 000020

c) Z values close to 1 | ( .999) |>= -0. 001020

|<= -0. 000980

d) Z values close to 0 | (.001) |>= -6. 90789

|<= -6. 90761

e) Z a large magnitude integer] (10000) |>= 9. 21015

constant | |<= 9. 21524

f) Z a large magnitude non- | (3029.48) |>= 8. 01598

integer constant | |<= 8. 01630

g) Z a low magnitude non- | (.00005) |>= -9. 90368

integer constant | |<- -9. 90328

h) Z a large magnitude integer

|

(A) 13 .3044

variable | |<= 13 .3050

i) Z a large magnitude non- | (F) |>= 10 .3733

integer variable | |<= 10 .3737

j) Z a low magnitude non- | (G) |>= -10 .8199

integer variable | |<= -10 .8195

k) z a subscripted constant | (IND(4)) j>= 1. 09859

|<= 1. 09863

40
Complex Tests (relative error = .00004)

Specific features to be tested Arguments

(argl)

a) Z values close to e | (E + .001) 1 1

.

000 i2

1 1 . 00040

b) z expr with value close to | (1 / 10) 1 2

.

30267

0 1 1 2 . 30249

c) z expr. with value close to

|

(E - .1) 1 f\U . n ^ o / "7 n y oz4 / y or equal to e | 1 '^'^ u

.

962556

d) z = expr. with value close to

|

(1 - .1) 1 0

.

105401

or equal to 1 ] 1 0 . 105321

e) z a subscripted variable | (IND(D - 5)) 1 n / coo

1

1 1

.

A / C A A 94599

f ) Z an integer expression | iU) \ oZ . 99561

using constants only | 1 0Z

Q Q C Q C 995o5

g) z an integer expression | (B + C) 1 1 09857

using variables only | i<= 1 A A O / C 09865

z = a non- integer expression | (3.2 / 1.7) i>= 0 632497

using constants only | i<= 0 632547

i) z a non- integer expression | (E - H) i>= 2 08164

using variables only | i<= 2 A O 1 O A 08180

J) z an integer expression | (B - 2) i>= 1

^ A A O "7 60937

using variables and | i<= 1

^ A A / A 60949

constants | k) z a non- integer expression | (E + 1.7) i>= 1 .48569

using variables and | i<= 1 .48581

constants | 1) LOG used as part of an | TEMP = L0G(E)+4 ITEMP

expression | |>= 4 .99980

j<= 5 .00002

m) LOG function used | TEMP = LOG(LOG(B)) |TEMP

recursively with | |>= 0 .665702

variables & expressions | |<= 0 .665756

n) The LOG function used | TEMP = L0G(E)+L0G(2) |TEMP

twice on an expression | |>= 1 .69307 <= 1 .69321

Expected

Answer

5.17 IF117A

a. Features Tested

This program tests the Intrinsic Function LOGIO . which returns a numeric value that approximates the logarithm to the base 10 of

argument- 1. The type of this function is numeric. Argument -1 must

be class numeric and must be greater than zero. The returned value

is the approximation of the logarithm to the base 10 of argument- 1.

41
FUNCTION LOGlO(argl)

b. Reference

Page A- 50

Section 2.21

c. Number of tests

33

d. Variables

VALUE

VALUE

VALUE

A PICTURE S9(10)

B PICTURE S9(10)

C PICTURE S9(10)

D PICTURE S9(10)

E PICTURE S9(1)V9(9)

F PICTURE S9(5)V9(5)

G PICTURE S9(5)V9(5)

H PICTURE S9(5)V9(5)

ARGl PICTURE S9(5)V9(5) VALUE 10.00

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

600000

74

VALUE 10

VALUE 2.718281828

VALUE 32000.8

VALUE . 00002

VALUE -5.3

Statements structure

At least one of the following COBOL statements must be usedto test

the features given below. Each type of statement is to be allocated

the first corresponding argument (s) in the table and then all

remaining arguments tested with the COMPUTE statement where

possible

.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL function LOGlO(argl) < .30

procedure -name -

1

argl = argl - 1.00

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

42
arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested | Arguments 1 Expected

(argl) 1

1 Answer

a) Z = 1 1 (1) j>=- 0. 000020

|<= 0. 000020

b) Z = 10 1 (10) l>= 0. 999980

|<= 1. 000020

c) Z = .01 1 (.01) |>=- 2. 00004

|<=- 1. 99996

d) Z = 001 1 (.001) |>=- 3. 00006

j<=- 2. 99994

e) Z = 100 1 (100) |>= 1. 99996

j<= 2. 00004

f) z = values close to 10 | (9 . 999) |>= 0. 999936

|<= 0. 999976

g) z = values close to 1 | (1.001) |>= 0. 000425

|<= 0. 000443

h) Z = values close to .01 | ( . 009) |>=- 2. 04579

|<=- 2. 04571

i) Z = values close to 100 | (100 .1) |>= 2 00039

|<= 2 00047

j) z = a large magnitude integer] (10000) |>= 3 99992

constant | i<= 4 00008

k) Z = a large magnitude non- (3029 .48) i>= 3 48129

integer constant i<= 3 48143

1) Z = a low magnitude non- ( .00005) i>=-•4 30111

integer constant i<=-4 30093

m) Z = a large magnitude integer (A) i>= 5 77803

variable i<= 5 77826

n) Z = a large magnitude non- (F) i>= 4 50507

integer variable i<= 4 .50525

o) Z = a low magnitude non- (G) i>=--4 .69906

integer variable i<= -4 .69888

P) z = a subscripted constant (IND(4)) i>= 0 .477111

1 ^^ 0 .477131

Complex Tests (relative error = 00004)

Specific features to be tested Arguments Expected

(argl) Answer

a) Z = values close to e (E + .001) i>= 0 .434437

i<= 0 .434471

43
n) LOGIO used as part of an expression

o) LOGIO function that invokes

itself, using variables &

expressions

p) LOGIO function used twice

within an expression

b) Z = expr with value close to | (1 / 10) |>=- 1. 00004

|<=- 0. 999960

c) Z = expr. with value close to

|

(E - .1) |>= 0. 417999

or equal to e | |<= 0. 418033

d) Z = expr. with value close to

|

(1 - .1) |>=- 0. 045775

or equal to 1 | |<=- 0 045740

e) Z = expr. with value close to

|

(10 A 1.1) |>= 1 04135

or equal to 10 | |<= 1 04143

f) Z = expr with value close to | ((A G)/ 1000) |>=- 1 92090

or equal to .01 | |<=- 1 92074

g) Z = a subscripted variable | (IND(D - 5)) |>= 0 845064

|<= 0 845132

h) Z = an integer expression | (2 k 10) |>= 1 30097

using constants only | |<= 1 30107

i) Z = an integer expression | (B + C) |>= 0 477102

using variables only | i<= 0 .477140

j) Z = a non- integer expression | (3. 2 / 1.7) i>= 0 .274690

using constants only | i<= 0 .274712

k) Z = a non- integer expression | (E H) i>= 0 .904045

using variables only | i<= 0 .904117

1) Z = an integer expression | (B 2) >= 0 .698942

using variables and | i<= 0 .698998

constants | m) Z = a non- integer expression | (E + 1.7) j>= 0 .645227

using variables and | i<= 0 .645279

constants 1 TEMP = LOGIO (B) + 4

TEMP=LOG 1 0 ( LOG 1 0 ( 2 )

)

TEMP=LOG10 ( 1 ) +L0G10 ( 1

)

TEMP: >= 4.84490 <= 4.84529

TEMP:

>=-0. 521411

<=-0. 521369

TEMP:

>=- 0.000040 <= 0.000040

5.18 IF118A

a. Features Tested

This program tests the Intrinsic Function LOWER-CASE . which returns

a character string that is the same length as argument-1 with each

uppercase letter replaced by the corresponding lowercase letter.

The type of this function is alphanumeric. Argument-1 must be class

alphabetic or alphanumeric and must be at least one character in

length. The character string returned has the same length as argument-1. If the computer character set does not include lower

case letters, no changes take place in the character string.

44
FUNCTION LOWER-CASE (argl)

b. Reference

Page A- 51

Section 2.22

c. Number of tests

13

d. Variables

A PICTURE A(10)

B PICTURE A (10)

C PICTURE X(10)

D PICTURE X(10)

E PICTURE X(10)

TEMP PICTURE S9(10)

VALUE "tumble"

VALUE "WEED"

VALUE "Was"

VALUE "4"

VALUE "And4"

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument (s) in the table and then all

remaining arguments tested with the MOVE statement where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) MOVE identifier-1 TO identifier-2

3) IF condition- 1 THEN

statement

ELSE

statement

Identifier-1 refers to a function invocation.

Identifier-2 must never be used as function invocation.

Condition- 1 refers to a conditional expression for which one of its operands is an Intrinsic Function.

Specific features to be tested

a) Z = constant string of only

lower case alphabetic

characters

b) Z = constant string of only

upper case alphabetic

characters

c) Z = constant string of mixed

case alphabetic chars

Arguments

(argl)

( " figure"

)

("CAPS")

("highnLOW")

Expected

Answer

figure

caps

highnlow

45
d) Z = constant string of non- alphabetic characters

e) Z = constant string of

alphabetic and non- alphabetic characters

f) Z = variable string of all

lower case alphabetic

characters

g) Z = variable string of all

upper case alphabetic

characters

h) Z = variable string of mixed

case alphabetic chars

i) Z = variable string of non- alphabetic characters

j

) Z = variable string of

alphabetic and non- alphabetic characters

k) LOWER-CASE used as part

of an expression

1) LOWER-CASE used to invoke

itself

m) LOWER-CASE used twice in an expression

("95")

("SisaNUMBER")

(A)

(B)

(C)

(D)

(E)

TEMP=LENGTH ( LOWER - CAS E

("GIZZARD") )+2

LOWER - CAS E ( LOWER -CASE

("GIZZARD")

)

TEMP=LENGTH (LOWER- CASE

( " HOME " )

) +LENGTH ( LOWER

CASE ( "HOME" )

)

95

Sisanumber

tumble

weed

was

4

and4

TEMP = 9

gizzard

TEMP = 8

5.19 IF119A

a. Features Tested

This program tests the Intrinsic Function MAX . which returns the

content of the argument -1 that contains the maximum value. The type

of this function depends upon the argument types as follows:

Argument type Function Type

Alphabetic

Alphanumeric

All arguments integer

Numeric (some args . may be integer)

Alphanumeric

Alphanumeric

Integer

Numeric

If more than one argument- 1 is specified, all arguments must be of

the same class. If more than one argument- 1 has the same greatest

value, the content of the argument -1 returned is the leftmost

argument- 1 having that value. If the type of the function is

alphanumeric, the size of the returned value is the same as the size

of the selected argument-1.

46
FUNCTION MAX (argl ...)

b. Reference

Page A- 52

Section 2.23

c. Number of tests

24

d. Variables

A PICTURE S9(10)

B PICTURE S9(10)

C PICTURE S9(10)

D PICTURE S9(10)

E PICTURE S9(5)V9(5)

F PICTURE S9(5)V9(5)

G PICTURE S9(5)V9(5)

H PICTURE S9(5)V9(5)

I PICTURE X(l)

J PICTURE X(l)

M PICTURE S9(10)

N PICTURE S9(10)

0 PICTURE S9(10)

ARGl PICTURE S9(10)

ARR

IND OCCURS 5 TEMP PICTURE S9(10)

VALUE 5 VALUE 7 VALUE -4

VALUE 10

VALUE 34.26

VALUE -8.32

VALUE 4.08

VALUE -5.3

VALUE "R"

VALUE "U"

VALUE

VALUE

VALUE

VALUE

VALUE

1

3

5

1"40537"

TIMES PICTURE 9

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

must be used to test the features given below. Each type of

statement is to be allocated the first corresponding argument (s) in

the table and then all remaining arguments tested with the COMPUTE

statement where possible.

1) MOVE identifier-1 TO identifier-2 (*)

2) COMPUTE identifier-2 = arithmetic-expression-1

3) EVALUATE expression- 1 ALSO express ion2

4) IF condition- 1 THEN

statement -1

ELSE

statement2

5) PERFORM procedure -name -1 UNTIL FUNCTION MAX ( argl, 1) > 5

procedure -name -

1

argl = argl + 1

47
Identifier- 1 refers to a function invocation.

Identifier- 2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

* The MOVE statement should only be used on those cases where the

function type is alphanumeric.

Simple Tests (relative error = 0 or .00002)

Specific features to be tested Arguments

(argl ...)

a) Z — multiple integer | constants (all > 0) |

(5, 6, 10, 3, 7) 10

b) Z = multiple integer consts | (with numbers < 0) |(-4, 7, 304, 3, -8) 304

c) z = multiple non- integer | constants (all > 0) |

(4.3, 2.6, 7.3, 9.1) >=

<=

9.09982

9.10018

d) z - multiple non- integer | constants (with nums < 0)

|

(-4.3, 10.2, -0.7, 3.9) >=

<=

10.1998

10.2002

e) z = multiple integer | variables (all > 0) |(A, B, D) 10

f) z multiple integer vars | (with values < 0) |(A, B, C) 7

g) z multiple non- integer | variables (all > 0) |

(E, G) >=<=

34.2593

34.2607

h) z multiple non- integer | variables (with vars < 0)

|

(F, G, H) <=

4.07992

4.08008

i) z multiple variables and | and constants (all int) |(A, 4, 8, -10, C, 0) 8

j) z multiple variables and | constants (some non- int) |

(4, D, H, 6.3, -2.0) >=

<=

9.9998

10.0002

k) z multiple alphanumeric | characters |("R", I, "I", "a") a

1) z multiple alphabetic | characters |

("A", J, "J") U

m) z a series of subscripted | variables |

(IND(M), IND(N), IND(O)) 7

n) z a series of subscripted | constants |

(IND(l), IND(2), IND(3)) 5

o) z ALL used as a subscript | to reference a table | (IND(ALL)) 7 P) z a series of medium to low| (0.03, 0.029, 0.031 |>=0.030999

magnitude constants | 0.011) |<=0.031001

q) z a series of large | magnitude constants |

(31000, 310001, 78000,

29000, 12000)

310001

Expected

Answer

48
Complex Tests (relative error = .00002)

Specific features to be tested 1 Arguments 1 Expected

1 (argi . .

.

)

1 Answer

a) Z = multiple integer

expressions |<= 35.0007

b) Z = multiple non- integer

expressions

1 (E+4, H*2, 5+A) |>= 38.2592

1 <= JO . ZoUo

c) Z = multiple integer values

(all the same value)

1 (-7, -9+2, -7) |>=-7 .00014

|<=-6. 99986

d) MAX function that invokes 1 TEMP=MAX(MAX(14,A)

i TEMP

itself \ t-. ~~v= /i Q Q Q Q n |<= 50.0001

e) MAX function used as part

of an expression

1 TEMP=MAX(4,B,E)+2 1 TEMP

|>= 36.2593

|<= 36.2607

f) MAX function used twice

within an expression

1 TEMP=MAX(A,G)+MAX(B,0) 1 TEMP

|>= 11.9998

|<- 12.0002

5 . 20 IF120A

a. Features Tested

This program tests the Intrinsic Function MEAN , which returns a numeric value that is the arithmetic mean (average) of its

arguments. The type of this function is numeric. Argument-1 must

be class ntjimeric. The returned value is defined as the sum of the

argument-1 series divided by the number of occurrences referenced

by argument-1.

FUNCTION MEAN (argl ...)

b. Reference

Page A- 53

Section 2.24

c. Number of tests

18

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE 89(10) VALUE -4

49
c Q / 1 r\\ ^ 7 A T TTT7 1iUn

V TIT /^T'TTF) T7 El riCiUKc, by ( -) ; vy (, J

;

T7 A T T TT? J'+ . Z D

i>y \ D ) vy \ D ) \7 A T TTTT - O . J z

. Uo n riLiiUKrL, by^j^vy',,jj 17 A T ITP - 3 . J

c Q /' 1 n \ T7 A T TTTT J zuuuu

N PICTURE S9(I0) T7 A T T7T7 D DUUUU

0 PICTURE S9(10) 17 A T TTT? -4- jUUUU

P PICTURE S9(10) VALUE 1 Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 1 ARG2 PICTURE S9(10) VALUE 1 ARR VALUE "40537

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(10)V9(5)

Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION MEAN(argl , arg2) >

8

procedure -name -

1

argl = argl + 1 arg2 = arg2 + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of the operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

50
Simple Tests (relative error = 0 or .00002)

Specific features to be tested | Arguments

(argl ...)

Expected

Answer

a) Z = series of integer | (5, -2, -14, 0) >=- 2. 75006

constants | 2. 74995

b) Z = series of non- integer | (3.9, -0.3, 8.7, 100. 2) >= 28 .1244

constants | <= 28 .1256

c) z series of integer | (A, B, C, D) |>- 4. 49991

variables | <= 4. 50009

d) z series of non integer | (E, F, G, H) >= 6. 17988

variables | <= 6. 18012

e) z = series of integer and | (10.2, -0.2, 5.6, -15 .6) |>=- 0. 000020

non- integer constants | |<= 0. 000020

f) z series of integer and | (A, B, C, D, E, F, G, H) |>= 5. 33989 non- integer variables | |<= 5. 34011

g) z = a series of constants | (IND(2), IND(l), IND(3)) |>= 2. 99994

subscripted variables | i<= 3. 00006

h) z = a series of variable | (IND(P), IND(Q), IND(R)) |>= 5. 33323

subscripted variables | 1<= 5. 33344

i) z ALL used as a | subscript to reference | a table | (IND(ALL)) |>= 3. 79992

|<= 3. 80008

j) z a series of medium to low| (0.032, 0.019, 0. 014, |>= 0. 032499

magnitude constants | 0.065) |<= 0. 032501

k) z a series of large | (M, N, 0) 1 180000

magnitude variables | 1) z series of same values | (A, 5, A) 1 5

Complex Tests (relative error = .00002)

Specific features to be tested

a) Z = mixture of expressions

variables and consts

b) MEAN used as part of an expression

c) MEAN used twice within

an expression

Arguments

(argl ...)

(E, 9 * A. 0, B / 2)

TEMP=MEAN(A,B)+78

TEMP=MEAN(A,B)+

MEAN(-2.6, -4.4)

Expected

Answer

>= 20.6896 <= 20.6904

TEMP: >= 83.9983 <= 84.0017

TEMP: >= 2.49995 <= 2.50005

51
d) MEAN function that invokes

itself

TEMP=MEAN(MEAN(4,2) ,6) TEMP

:

e) Z = mixture of expressions

and constants

(2.6 + 30, 4.5 * 2)

>= 4.49991 <= 4.50009 >= 20.7996 <= 20.8004

5.21 IF121A

a. Features Tested

This Program tests the Intrinsic Function MEDIAN , which returns the

content of the argument whose value is the middle value in the list

formed by arranging the arguments in sorted order. The type of this

function is numeric. Argument-1 must be class numeric. If the

number of occurrences referenced by argument-1 is odd, the returned

value is such that at least half of the occurrences referenced by

argument-1 are greater than or equal to the returned value and at

least half are less than or equal. If the number of occurrences

referenced by argument-1 is even, the returned value is the

arithmetic mean of the values referenced by the two middle

occurrences

.

FUNCTION MEDIAN (argl ...)

b. Reference

Page A- 54

Section 2.25

c. Number of tests

18

d Variables

A PICTURE S9(10)

B PICTURE S9(10)

C PICTURE S9(10)

D PICTURE S9(10)

VALUE 5 VALUE 7 VALUE -4

VALUE 10

M PICTURE S9(10)

N PICTURE S9(10)

0 PICTURE S9(10)

P PICTURE S9(10)

Q PICTURE S9(10)

R PICTURE S9(10)

E PICTURE S9(5)V9(5)

F PICTURE S9(5)V9(5)

G PICTURE S9(5)V9(5)

H PICTURE S9(5)V9(5)

VALUE 34.26

VALUE -8.32

VALUE 4.08

VALUE -5.3

VALUE 320000

VALUE 650000

VALUE -430000

ARGl PICTURE S9(10)

VALUE 1 VALUE 3 VALUE 5 VALUE 2

52
ARG2 PICTURE S9(10) VALUE 2 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement

ELSE

statement

4) PERFORM procedure -name -1 UNTIL FUNCTION MEDIAN

(l,argl,arg2,20) > 10

procedure - name -

argl = argl + 1

arg2 = arg2 + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = 0 or ,00002)

Specific features to be tested 1 Arguments Expected

1 (argl ...) Answer

a) Z = series of integer 1 (5, -2, -14, 0) 1 constants

b) Z = series of non- integer 1 (3.9, -0.3, i3.7, 100.2) 6 29987

constants <= 6 30013

c) Z = series of integer 1 (A, B, C, D) 6

variables

d) Z = series of non- integer 1 (E, F, G) |>= 4 07992

variables |<= 4 08008

e) Z = series of integer and 1 (10.2, -0.2, 5.6, -15.6) |>= 2 69995

non- integer constants |<= 2 70005

f) Z = series of integer and 1 (A, B, C, D, E, F, G) |>= 4 99990

non- integer variables |<= 5 00010

53
g) Z = a series of

subscripted constants

h) Z = a series of

subscripted variables

i) Z = ALL used as a subscript to reference

a table

j) Z = a series of medium to low

magnitude constants

k) Z = a series of large

magnitude variables

1) Z = series of same values

(IND(l), IND(2), IND(3))

(IND(P), IND(Q), IND(R))

(IND(ALL))

(0.065, 0.030, 0.021,

0.014)

(M, N, 0)

(A. 5, A)

>= 0.025499 <= 0.025501

320000

Complex Tests (relative error = .00002)

Sp ecific features to be tested 1 Arguments

1 (argl ...)

1 Expected

1 Answer

a) Z = mixture of expressions

and constants

1 (2.6 + 30, 4.5 * 2) |>= 20.7996

|<= 20.8004

b) Z = mixture of expressions

variables and consts

1 (E, 9 * A, B / 2) |>= 34.2593

I<= 34.2607

c) MEDIAN used as part of

an expression

1 TEMP=MEDIAN(A, B)+78 1 TEMP

:

|<= 83.9983

|>= 84.0017

d) MEDIAN used twice 1 TEMP=MEDIAN(A,B)+ 1 TEMP

:

within an expression 1 MEDIAN(-2.6, -4.4, 1) |>= 3.39932

|<= 3.40007

e) MEDIAN function that 1 TEMP=MEDIAN (MEDIAN 1 TEMP

:

invokes itself 1 (1, 2), 3) |>= 2.24995

|<= 2.25004

5.22 IF122A

a. Features Tested

This program tests the Intrinsic Function MIDRANGE . which returns

a numeric value that is the arithmetic mean (average) of the values

of the minimum argument and the maximum argument. The type of this

function is numeric. Argument- 1 must be class numeric. The

returned value is the arithmetic mean of the greatest argument1

value and the least argument -1 value.

54
FUNCTION MIDRANGE (argl ...)

b. Reference

Page A-55

Section 2.26

c. Number of tests

18

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE -4

D PICTURE S9(10) VALUE 10

E PICTURE S9(5)V9(5) VALUE 34.26

F PICTURE S9(5)V9(5) VALUE -8.32

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE -5.3

M PICTURE S9(10) VALUE 320000

N PICTURE S9(10) VALUE 650000

0 PICTURE S9(10) VALUE -430000

P PICTURE S9(10) VALUE 1 Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 2 ARR VALUE "40537

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition-1 THEN

statement1

ELSE

statement-2

4) PERFORM procedure- name -1 UNTIL FUNCTION

MIDRANGE (1, argl) > 10

procedure -name -

1

argl = argl + 1

55
Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands LS

Intrinsic Function.

Simpl e Tests (relative error = 0 OL . \J\J\J\J J

Specific features to be tested EiXpec tea.

1 \, ax. gj. . . . ) n.i Lo w c 1.

3.) L = series or inceger 1 -9 -Mx 0\ 1 >=^ -4 5000Q cons tants 1 <-=— .A AQQQ1

D ^ L = series of non- integer ^ ) i 4Q Q4Q0

constants 1

1 ^—

ZiQ QSIO

c ; Z = series of integer 1 (A, B, C, D)

variables

d; z = series of non integer 1 (E, F, G, H) 1

1 variables 1 <^

1 \

1 9 070*^ e ; Z = series of integer and 1 (10.2, -0.2, 5.6, -15 .6) 1 non- integer constants 1 ^

1 —

f) Z = series of integer and 1 (A, B, C, D, E, F, G, H) non- integer variables 1 iz . y /u

J

g) z = mixture of expressions 1 (2.6 + 30, 4.5 * 2) on ^OQC zu . / y y

b

and constants 1 ^ on Qnn/i ZU . OUU'4- h) Z = a series of constant 1 (IND(l), IND(2), IND(3)) |>= 2.49995

subscripted variables |<= 2.50005

i) Z = a series of variable 1 (IND(F), IND(Q), IND(R)) j>= 5.49989

subscripted variables |<= 5.50011

j) z = ALL used as a subscript to reference 1 (IND(ALL))

a table |>= 3.49993

|<= 3.50007

k) Z = a series of medium to low 1 (0.065, 0.030, 0.020, |>= 0.039499

magnitude constants 1 0.014) |<= 0.039501

1) z = a series of large 1 (M, N, 0) 1 110000

magnitude variables

m) Z = series of same values 1 (A, 5, A) 5

Complex Tests (relative error = .00002)

Specific features to be tested 1 Arguments Expected

1 (argl ...) Answer

a) Z = mixture of expressions 1 (E, 9 * A, 0, B / 2) 22.4995

variables and consts j<= 22.5004

56
b) MIDRANGE used as part

of an expression

TEMP=MIDRANGE(A,B)+78 TEMP

:

>= 83.9983 <= 84.0017

c) MIDRANGE used twice TEMP:

within an expression

TEMP=MIDRANGE ( A , B )

+

MIDRANGE (-2. 6, -4.4) >= 2.49995 <= 2.50005

d) MIDRANGE function used TEMP:

recursively

TEMP=MIDRANGE (MIDRANGE

(1, 3), 5) |>= 3.49993

[<= 3.50007

5.23 IF123A

a. Features Tested

This program tests the Intrinsic Function MIN . which returns the

content of argument -1 that contains the minimum value. The type of

this function depends upon the argument types as follows:

If more than one argument is specified, all arguments must be of

the same class. The returned value is the content of the argument1

having the least value. If more than one argument-1 has the same least value, the content of argument-1 returned is the leftmost

argument-1 having that value. If the type of the function is

alphanumeric, the size of the returned value is the same as the size

of the selected argument-1.

FUNCTION MIN (argl . .

.

)

b. Reference

Page A- 56

Section 2.27

c. Number of tests

Argument type Function Type

Alphabetic

Alphanumeric

All arguments integer

Numeric (some args . may be integer)

Alphanumeric

Alphanumeric

Integer

Numeric

24

d. Variables

A PICTURE S9(10)

B PICTURE S9(10)

C PICTURE S9(10)

D PICTURE S9(10)

VALUE 5 VALUE 7 VALUE -4

VALUE 10

57
E PICTURE S9(5)V9(5)

F PICTURE S9(5)V9(5)

G PICTURE S9(5)V9(5)

H PICTURE S9(5)V9(5)

I PICTURE X(l)

J PICTURE X(l)

M PICTURE S9(10)

N PICTURE S9(10)

0 PICTURE S9(10)

ARGl PICTURE S9(10)

ARR

VALUE 34.26

VALUE -8.32

VALUE 4.08

VALUE -5.3

VALUE "R"

VALUE "U"

VALUE 1 VALUE 3 VALUE 5 VALUE 15

VALUE "40537 II IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

Statements structure

At least one of the following COBOL statements, excluding PERFORM,

must be used to test the features given below. Each type of

statement is to be allocated the first corresponding argument(s) in

the table and then all remaining arguments tested with the COMPUTE

statement where possible.

1) MOVE identifier-1 TO identifier-2 (*)

2) COMPUTE identifier-2 = arithmetic-expression-1

3) EVALUATE expression- 1 ALSO expression-2

4) IF condition- 1 THEN

statement1

statement-2

5) PERFORM procedure- name -1 UNTIL FUNCTION MIN(argl,20) < 10

procedure - name -

1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

* The MOVE statement should only be used on those cases where the

function type is alphanumeric.

ELSE

argl = argl - 1

58
Simple Tests (relative error = 0 .00002)

Specific features to be tested | Arguments Expected

(argl . . .) lis w t; L

a) z = multiple integer | constants (all > 0) |

(5, 6, 10, 3, 7)

b) z = multiple integer consts | (with numbers > 0) |

(-4, 7, 2304, 3, - o ; o - o

c) z = multiple non- integer j constants (all > 0) |

(4.3, 2 .6, 7.3, Q 1 ^ <= 2.60005

d) z multiple non- integer | constants (with nums < 0)

|

(-4.3, 10.2, -0. 7 Q ^ <=

- '->r . juuuy

-4.29991

e) z = multiple integer | variables (all > 0) j

(A, B, D) cD

f) z = multiple integer vars | (with values < 0) |

(A, B, C, D) 1. -

g) z multiple non- integer | variables (all > 0) |

(E, G) /, n 7 Q Q 0

. UOUUo

h) z = multiple non- integer | variables (with vars < 0)

|

(E, F, G, H) <= -8.31983

i) z multiple variables and | and constants (all int) |

(A, 4, 8, -10, C , u )

j) z = multiple variables and | constants (some non-mt) |

(4, D, E, 6.3, - z . u ; ^—<= -1.99996

k) z multiple alphanumeric | ("R", I, "I", "a "

)I X characters | 1) z multiple alphabetic | characters |

("a", J . "J") T

m) z = a series of constant | (IND(l), IND(2), IND(3)) n subscripted variables | n) z a series of variable | subscripted variables |

(IND(M) , IND(N), IND(O)) 4

o) z ALL used as a subscript | to reference a table | (IND(ALL)) 0

P) z a series of medium to lowj (0.13, 0.14, 0.15, 0.16) 0.129997

magnitude constants | l<=0.130003

q) z a series of large | magnitude constants j

(31000,

29000,

310001,

12000)

78000, 12000

Complex Tests (relative error = .00002)

Specific features to be tested

a) Z = multiple integer

expressions

b) Z = multiple non- integer

expressions

Arguments

(argl ...)

(A*B, (3+l)/2, 3+4)

(E+4, H*2, 5+A)

Expected

Answer

>= 1.99996 <= 2.00004

>=-10.6002

<=-10.5998

59
c) Z = multiple integer values | (-7 -9+2. (-B)) |>=-7 00014

(all the same value) | |<=-6 99986

a MIN function that TEMP=MIN(MIN(14 , A)

,

|TEMP

invoices itself E 50)-* |>= 4

|<= 5 99990

00010

e) a MIN function used as | TEMP=MIN(4,B,E)+A |TEMP

part of an expression | 1 >= o 1<= 9

n n o o 99982

00018

f) a MIN function used twice

|

TEMP=MIN ( A , E ) +MIN ( B , 0

)

|TEMP

within an expression | |>= 4

|<= 5 99990

00010

5.24 IF124A

a. Features Tested

This program tests the Intrinsic Function MOD . which returns an integer value that is argument-1 modulo argument-2. The type of

this function is integer. Argument-1 and Argument-2 must be

integers and the value of argument-2 must not be zero. The returned

value is defined as

:

argl-(arg2 * FUNCTION INTEGER (argl/arg2))

FUNCTION MOD (argl arg2)

b. Reference

Page A- 57

Section 2.28

c. Number of tests

21

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE -4

ARG2 PICTURE S9(10) VALUE 1 TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

60
1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression-2

3) IF condition- 1 THEN

statement-1

ELSE

statement-2

4) PERFORM procedure -name -1 UNTIL FUNCTION MOD(5,arg2) >= 2

procedure -name -

1

arg2 = arg2 + 1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = 0 or .00002)

Specific features to be tested Arguments 1 Expected

(argl, arg2) Answer

a) argl = arg2 (both constants) (6, 6) 0

b) argl > arg2 (both constants) (11. 5) 1

c) argl < arg2 (both constants) (10, 20) 10

d) argl = var, arg2 = var (A, B) 5

e) argl = var, arg2 = const (A, -3) -1

f) argl = const, arg2 = var (23, B) 2

g) argl < 0, arg2 < 0 (-11, -5) -1

h) argl > 0, arg2 < 0 (11, -5) -4

i) argl < 0, arg2 > 0 (-11. 5) 4

Complex Tests (relative error = 00002)

Specific features to be tested Arguments Expected

(argl, arg2) Answer

a) argl = const, arg2 = function (35, INTEGER(A*B)) |>= -0.000020

invocation |<= 0.000020

b) argl = var, arg2 = function (A, INTEGER(B-5)) 0.999980

invocation |<= 1.00002

c) argl = function invocation (INTEGER(A-B) , 9) |>= 6.99986

arg2 = constant |<= 7.00014

d) argl = function invocation (INTEGER((A-l-B)/-2) , -4) |>= -2.00004

arg2 = constant |<= -1.99996

61
e) argl = function invocation | arg2 = function invocation

f) argl = MOD Fxn, arg2 = var

g) argl = var, arg2 = MOD Fxn

h) argl = MOD Fxn, arg2 MOD Fxn

i) The MOD function used

within an expression

j

) a MOD function that invokes

itself

k) a MOD function used twice

within an expression

(INTEGER(A*B) , INTEGER(B-A) ) |>= 0.999980 <= 1.00002

(MOD(B, A), A) j>= 1.99996

<= 2.00004 >= 1.99996 <= 2.00004 >= 0.999980

<= 1.00002

TEMP: >= 6.99986 <= 7.00014

TEMP:

>=-0. 000020 <= 0.000020

TEMP: >= 0.999980 <= 1.00002

(C,MOD(C, B))

(M0D(9, 5),M0D(B,4))

TEMP = MOD(23,B)+A

TEMP =MOD(MOD(5,2) ,1)

TEMP = MOD(25,C)+

M0D(-11,5)

5.25 IF125A

a. Features Tested

This program tests the Intrinsic Function NUMVAL, which returns the

numeric value represented by the character string specified by

argument- 1. Leading and trailing spaces are ignored. The type of

this function is numeric. The returned value is the numeric value

represented by argument- 1. If the DECIMAL- POINT IS COMMA clause is

specified in the SPECIAL-NAMES paragraph, a comma must be used in

argument- 1 rather than a decimal point.

FUNCTION NUMVAL (argl)

Valid formats of argument- 1:

[space] [+/-] [space] digit [ . [digit]] [space]

[space] [+/-] [space] . digit [space] or

[space] digit [ . [digit]] [space] [x] [space]

[space] . digit [space] [x] [space]

where x is one of +, - , CR, or DB

The total number of digits of argument- 1 must not exceed 18.

b. Reference

Page A- 58

Section 2.29

62
Number of tests

20

d. Variables

A PICTURE

B PICTURE

C PICTURE

D PICTURE

E PICTURE

PICTURE

PICTURE

PICTURE

PICTURE

X(l)

X(5)

X(4)

X(7)

X(9)

X(7)

X(8)

X(6)

X(9)

VALUE

VALUE

VALUE

VALUE

VALUE

"4"

"203"

" .429"

"928.344"

" -042. 3240"

VALUE " 23.000"

VALUE "-92924.3"****

VALUE "93.21+"

VALUE " 92.92 -" TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument(s) in the table and then all

remaining arguments tested with the COMPUTE statement where

possible

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition- 1 THEN

statement

ELSE

statement -2

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Relative error = 0 or .00002

Specific features to be tested

a) Z = constant string "N"

b) Z = constant string "NN. . .N"

c) Z = constant string ".NN...N"

d) Z = constant string

"NN. . .N.NN. . .N"

Arguments

(argl)

("9")

("4738")

(" .935")

("385.93")

Expected

Answer

9 4738

|>= 0.934981

|<= 0.935019

|>= 385.922 <= 385.938

63
e) Z constant string | "SNN. . .N.NN. . .N "

1

("+394.2") |>= 394.192

|<= 394.208

f) z constant string | " NN. . .N.NN. . .N" 1

(" 939.83") |>= 939.811

|<= 939.849

g) z constant string | " S NN . . . N . NN . . . N "

1

(" - 4929.0323 ") |>=-4929.1309

|<=-4928.9337

h) z constant string | "NN. . .N.NN. . .NS" 1

("82.9312+") |>= 82.9295

|<= 82.9329

i) z constant string | " NN . . . N . NN . . . N S "

1

(" 200.0002 ") |>—200.0042

|<=-199.9962

j) z variable string "N" | (A) 1 ^

z = variable string "NN. . .N" | (B) 1 203

1) z variable string ".NN...N"| (C) |>= 0.428991

|<= 0.429009

m) z _ variable string | "NN. . .N.NN. . .N" 1

(D) |>= 928.325

|<= 928.363

n) z variable string | " SNN . . . N . NN . . . N "

1

(E) i>=-42.3248

|<=-42.3232

o) z variable string | " NN. . .N.NN. . .N" 1

(F) |>= 22.9995

|<= 23.0005

P) z variable string | " S NN . . . N . NN . . . N "

1

(G) |>=-92926.16

|<=-92922.44

q) z _ variable string | "NN. . .N.NN. . .NS" 1

(H) |>= 93.2081

|<= 93.2119

r) z variable string | " NN . . . N . NN . . . N S "

1

(I) |>=-92.9219

|<=-92.9181

s) NUMVAL used as part of an|

expression | TEMP=NUMVAL ("90" )+10 1 TEMP = 100

t) NUMVAL used twice in an | expression |

TEMP = NUMVAL("2"

NUMVAL("8")

) + 1 TEMP = 10

5.26 IF126A

a. Features Tested

This function tests the Intrinsic Function NUMVALC

. which returns

the numeric value represented by the character string specified by

argument- 1. Any optional currency sign specified by argument- 2 and

any optional commas preceding the decimal point are ignored. The

type of this function is numeric. The returned value is the numeric

value represented by argument- 1. If the DECIMAL-POINT IS COMMA

clause is specified in the SPECIAL- NAMES paragraph, the functions

of the comma and decimal point in argument- 1 are reversed.

FUNCTION NUMVAL-C (argl [arg2])

Valid formats of argument 1:

[space] [+/-] [space] [cs] [space] digit [, digit] ... [. [digit]]

[ space

]

64
[space] [+/-] [space] [cs] [space] . digit [space]

or

[space] [cs] [space] digit [, digit]... [. [digit]] [space] [x]

[space]

[space] [cs] [space] . digit [space] [x] [space]

where x is one of +, -, CR, or DB

The total number of digits in argument-1 must not exceed 18.

Argument- 2, if specified must be a nonnuimeric literal or alphanumeric data item. If argument- 2 is not specified, the

character used for cs is the currency symbol specified for the

program.

b. Reference

Page A- 59

Section 2 . 30

c. Number of tests

30

d. Variables

A PICTURE X( 1) VALUE II 4"

B PICTURE X( 5) VALUE II 203"

C PICTURE X( 4) VALUE II .429"

D PICTURE X( 7) VALUE II 928.344"

E PICTURE X( 9) VALUE II -042.3240"

F PICTURE X(7) VALUE II 23.000"

G PICTURE X(:8) VALUE II -92924.3"

H PICTURE X(:6) VALUE II 93.21-f-"

I PICTURE X([9) VALUE II 92.92 -" J PICTURE X([9) VALUE II 8,848.934"

K PICTURE X(:i2) VALUE II 4,825,293.92"

L PICTURE X(:i2) VALUE II - 5,555.55 " M PICTURE X([9) VALUE II 5,555.55-"

N PICTURE X(:i3) VALUE II 77,777.77 +

" 0 PICTURE X(;3) VALUE II $33"

P PICTURE X(:5) VALUE II $0.11"

Q PICTURE X(:9) VALUE II $4,000.00"

R PICTURE X<:i4) VALUE 11 $1,000,000.50"

S PICTURE X :i4) VALUE II $ 3,900.21 " T PICTURE X :i4) VALUE II + $ 9,000.99"

U PICTURE X :i5) VALUE II $ 3,890.20 + TEMP PICTURE S9(5)V9(5)

65
e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument(s) in the table and then all

remaining arguments tested with the COMPUTE statement where

possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Relative error = 0 or .00002

Specific features to be tested | Arguments

(argl ...)

1 Expected

1 Answer

no argument 2 for tests a) - o) |

a) argl = constant string "N" | ("9") 1 9

b) argl = variable string | (B) 1 203

"NN...N" 1 c) argl = constant string | ("92,483" ) 1 92483

"NN. . .N,NN. . .N" 1 d) argl = variable string | (C) |>= 0.428991

".NN...N" 1 |<= 0.429009

e) argl = constant string | ("385.93" ) |>= 385.922

"NN. . .N.NN. . .N" 1 |<= 385.938

f) argl = variable string | (J) |>= 8848.76

"NN. . .N,NN. . .N.NN. . .N"

1

|<= 8849.11

g) argl = constant string | ("+394.2 ") |>= 394.192

"SNN. . .N.NN. . .N "

1 |<= 394.208

h) argl = constant string | (" 939.8 3") |>= 939.811

" NN. . .N.NN. . .N" 1 |<= 939.849

i) argl = constant string | (" - 4929. 0323") |>=-4929.1309

" S NN . . . N . NN . . . N "

1 |<=-4928.9337

j ) argl = variable string | (K) |>= 4825197.4

SNN. . .N,NN. . .N,NN. . .N.NN. . .N"

1

|<= 4825390.4

argl = variable string | (L) |>=-5555.66

" S NN . . . N , NN . . . N . NN . . . N "

j |<=-5555.44

66
1) argl = constant string

"NN. . .N.NN. . .NS"

m) argl = variable string

"NN. . .N,NN. . .N.NN. . .NS"

n) argl = constant string

" NN . . . N . NN . . . N S

" o) argl = variable string

" NN . . . N , NN . . . N . NN . . . N S

" argument 2 = currency sign

for test p) - cc)

p) argl = constant string "2N"

q) argl = variable string

"2NN. . .N"

r) argl = constant string

"2NN. . .N,NN. . .N"

s) argl = constant string

"2NN. . .N.NN. . .N"

t) argl = variable string

"2NN. . .N,NN. . .N.NN.

u) argl = constant string

"S2NN. . .N.NN. . .N"

v) argl = variable string

"S2NN. . .N,NN. . .N.NN. . .N.NN

w) argl = constant string

" 2 NN. . .N.NN. . .N"

x) argl = variable string

" 2 NN . . . N , NN . . . N . NN . . . N

" y) argl = constant string

"S 2 NN. . .N.NN. . .N"

z) argl = variable string

"S 2 NN. . .N.NN. . .N.NN. . .N"

aa) argl = constant string

" 2 NN . . . N . NN . . . N S

" bb) argl = variable string

" 2 NN. . .N.NN. . .N.NN. . .N S cc) NUMVAL-C used as part of an expression

dd) NUMVAL-C used twice in an expression

N"

N"

("82.9312+")

(M)

(" 200.0002 - ")

(N)

("$5", "$")

(0, "$")

("$93,021", "$")

("$924.93", "$")

(Q, "$")

("-$34.03", "$")

(R, "$")

(" $ 89.01", "$")

(S, "$")

("- $ 890.21", "$")

(T, "$")

(" $ 90.54 - ","$")

(U, "$")

TEMP=NUMVAL- C

( " 90" ) +10

TEMP=NUMVAL- C

( " 2

" ) + NUMVAL-C("8")

>= 82.9295

<= 82.9329

>=-5555.66

<=-5555.44

>=- 200. 0042

<=-199.9962

>= 77776.21 <= 77779.33

5

33

93021

>=924.912

<=924.948

4000

>=-34.0307

<=-34.0293

>= 999980.5

<=1000020.5

>= 89.0082 <= 89.0118 >= 3900.13 <= 3900.29

>=-890.228

<=-890.192 >= 9000.81 <= 9001.17

>--90.5418

<=-90.5382

>= 3890.12 <= 3890.28

TEMP = 100

TEMP = 10

67
5.27 IF127A

a. Features Tested

This program tests the Intrinsic Function ORD . which returns an integer value that is the ordinal position of argument-1 in the

collating sequence for the program. The lowest ordinal position is

1. The type of this function is integer. Argument-1 must be one character in length and must be class alphabetic or alphanumeric.

The returned value is the ordinal position of argument-1 in the

collating sequence for the program.

FUNCTION ORD (argl)

b. Reference

Page A- 60

Section 2.31

c. Number of tests

9

d. Variables

A PICTURE X

B PICTURE X

C PICTURE X

ARGl PICTURE X

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure- name -1 UNTIL FUNCTION ORD (argl) = 67

procedure - name -

1

argl = "B"

VALUE "F

VALUE "d

VALUE "3

VALUE "A

68
Identifier- 2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested 1 Arguments

1 (argl . .

.

)

1 Expected

1 Answer

a) Z = constant upper case 1 ("A") 1 66

alphabetic character

b) Z = constant lower case 1 ("m") 1 110

alphabetic character

c) Z = constant numeral 1 ("5") 1 54

character

d) Z = variable upper case 1 (A) 1 71

alphabetic character

e) Z = variable lower case 1 (B) 1 101

alphabetic character

f) z = variable numeral 1 (C) 1 52

character

g) ORD used in an expression 1 TEMP=ORD("g" )+l 1 TEMP =105

h) ORD used twice in an 1 TEMP=ORD("A" )+ORD(A) 1 TEMP = 137

expression

5.28 IF128A

a. Features Tested

This program tests the Intrinsic Function ORD -MAX . which returns a value that is the ordinal number of the argument -1 that contains

the maximum value. The type of this function is integer. If more than one argument- 1 is specified, all arguments must be of the same class. The returned value is the ordinal number that corresponds

to the position of the argument- 1 having the greatest value in the

argument -1 series. If more than one argument -1 has the same greatest value, the number returned corresponds to the position of

the leftmost argument- 1 having that value.

FUNCTION ORD-MAX (argl ...)

b. Reference

Page A-61

Section 2.32

69
Number of tests

16

Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE 4

D PICTURE S9(10) VALUE 10

I PICTURE X(4) VALUE "R"

J PICTURE X(4) VALUE "U"

P PICTURE S9(10) VALUE 1

Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 1 ARR VALUE "4

IND OCCURS 5 TIMES PICTURE

0537"

9

TEMP PICTURE S9(10)

Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier- 2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement-1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION 0RD-MAX(5 , argl) =

2

procedure - name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

70
Specific features to be tested | Arguments | Expected

(argl ...) 1 Answer

a) Z = multiple integer | constants |

(5, 3, 2, 8, 3, 1) 1 4

b) Z = multiple integer consts | (3, 2, 7, 1, 5) 1 3

c) Z = multiple integer | variables |

(A, B, D) 1 3

d) Z = multiple integer | variables |

(A, B, C) 1 2

e) Z = multiple variables and | and constants |

(A, 4, B, 7, C, 9) 1 6

f) Z = multiple variables and | constants |

(4, 9, A, 3) 1 2

g) Z = multiple alphanumeric | characters |

("A", I, "P") 1 2

h) Z = multiple alphabetic | characters |

("S", "D", J) 1 3

i) Z = multiple vars and consts |

( all the same value) |

(A, 5, 5, A) 1 1

j) Z = a series of subscripted | variables |

(IND(l), IND(2), IND(3))| 3

k) Z = a series of subscripted | constants |

(IND(R), IND(P), IND(Q))| 1

1) Z = ALL used as a subscript | to reference a table | (IND(ALL)) 1 5

m) ORD-MAX function that invokes

itself 1

TEMP=ORD- MAX (ORD-MAX | (1,4), 3, 1) 1

2

n) ORD-MAX function used as | part of an expression | TEMP=ORD-MAX(2,3,C)+A | TEMP = 8

o) ORD-MAX function used twice | within an expression | TEMP=ORD-MAX(2,3,A)+ | 0RD-MAX(1,1) jTEMP = 4

5.29 IF129A

a. Features Tested

This program tests the Intrinsic Function ORD-MIN . which returns a value that is the ordinal number of the argument that contains the

minimum value. The type of this function is integer. If more than

one argument- 1 is specified, all arguments must be of the same

class. The returned value is the ordinal number that corresponds

to the position of the argument -1 having the least value in the

argument- 1 series. If more than one argument- 1 has the same least

value, the number returned corresponds to the position of the

leftmost argument -1 having that value.

71
FUNCTION ORD-MIN (argl ...)

b. Reference

Page A- 62

Section 2.33

c. Number of tests

17

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE 4

D PICTURE S9(10) VALUE 10

I PICTURE X(4) VALUE "R"

J PICTURE X(4) VALUE "U"

P PICTURE S9(10) VALUE 1 Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 10

ARR VALUE "4(

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition- 1 THEN

statement -1

ELSE

statement -2

4) PERFORM procedure- name -1 UNTIL FUNCTION 0RD-MIN(2 , argl) >

1

procedure - name -

1

argl = argl - 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

72
arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested 1 Arguments Expected

1 (argl ...) Answer

a) Z = multiple integer

constants

1 (5, 3, 2, 8, 3, 1) i 6

b) Z = multiple integer consts i (3, 2, 7, 1, 5) 4

c) z = multiple integer consts 1 (5, 4, 3, 6, 2 , 8) 1 5 d) z = multiple integer

variables

1 (A, B, C) 3

e) z = multiple integer

variables

1 (A, B, D) 1

f) z = multiple variables and

and constants

1 (A, 4, B, 7, 1, 9) 1 5

g) z = multiple variables and

constants

1 1, A, 3) 2

h) z = multiple alphanumeric

characters

1 ("A" 1 I, "P") 1

i) z = multiple alphabetic

characters

1 ("S" ) "D", J) 2

j) z = multiple vars and consts

( all the same value)

1 (A, 5, 5, A) 1

k) z = a series of constant 1 (IND(l), IND(2), IND(3))

2 subscripted variables

1) z = a series of variable 1 (IND(P), IND(Q), IND(R))

1 subscripted variables

m) ORD-MIN function that 1 TEMP=ORD-MIN(ORD-MIN 1 1 invokes itself 1 (1,4) ,3, 7))

n) Z = ALL used as a subscript

to reference a table 1 (IND(ALL)) 2 o) ORD-MIN function used as 1 TEMI•=ORD-MIN(2,3,C)+A | TEMP = 6 part of an expression

P) ORD-MIN function used 1 TEMP=ORD-MIN(9,3,A)+ | TEMP = 3 twice within an expression 1 0RD-MIN(1,1)

5.30 IF130A

a. Features Tested

This program tests the Intrinsic Function PRE SENT- VALUE . which

returns a value that approximates the present value of a series of

future period- end amounts specified by argument- 2 at a discount rate

specified by argument-1. The type of this function is numeric. The

returned value is an approximation of the summation of a series of

calculations with each term in the following form:

arg2 / (1 + argl) n

73
There is one term for each occurrence of argument- 2. The exponent,

n, is incremented from one by one for each term in the series.

Argl = discount rate and must be greater than -1.

Arg2 = the series of integer and non- integer end-period

amounts

.

n = end-period position in arg2 series.

FUNCTION PRESENT-VALUE (argl arg2 ...)

b. Reference

Page A- 63

Section 2.34

c . Number of tests

21

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE -4

D PICTURE S9(10) VALUE 10

E PICTURE S9(5)V9(5) VALUE 34.26

F PICTURE S9(5)V9(5) VALUE -8.32

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE 5.3

I PICTURE S9(5)V9(5) VALUE 0.0009

J PICTURE S9(5)V9(5) VALUE 0.0008

K PICTURE S9(10) VALUE 23000

L PICTURE S9(10) VALUE -23000

P PICTURE S9(10) VALUE 1 Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 0

ARR VALUE "40537

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

74
3) IF condition- 1 THEN

statement1

ELSE

statement-2

4) PERFORM procedure -name -1 UNTIL FUNCTION

PRESENT-VALUE(argl,2) < .5

procedure -name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression- 2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested 1 f\ir gu-iuerit-s Expected

1 <.argi argz . . .

Answer

a) argl 0 1 < C\ O'K 19 Q^ |>=43.9991

for tests b) - t) argl = any <=44.0009

integer or non- integer > -1

b) arg2 multiple integer 1 (1, 10, 20, 10, 5) |>= 11.5623

constants |<= 11.5627

c) arg2 multiple non- integer 1 (.5, 8.3, 2.4, 9.9) |>= 9.53314

constants |<= 9.53352

d) arg2 multiple integer and 1 (.1, 5, 4, 2.8, 3.1. 17) 22.6274

non- integer constants I<= 22.6283

e) arg2 multiple integer 1 (.04, A, B, D) |>= 20.1691

variables i<= 20.1699

f) arg2 multiple non- integer 1 (.08, E, G, H, F) 33.3113

variables i<= 33.3127

g) arg2 multiple integer 1 (.2, C. A. 5. 4, 2) i>= 5.76505

constants and i<= 5.76528

variables

h) arg2 multiple integer and 1 (.3, A. H. .07, -19) j>= 0.361674

non- integer constants i<= 0.361689

and variables

i) arg2 multiple low magnitude 1 (.09, -.0009, -.0008) i>=--0.001500

constants i<=--0.001498

j) arg2 multiple large 1 (.4, 30000, 40000, i>= 57454.07

magnitude constants j 100000, -80000) i<= 57456.37

k) arg2 multiple large 1 (.07, L, K) i>=--1406.26

magnitude variables i<=--1406.21

1) arg2 multiple subscripted 1 (.15, IND(l). IND(2). i>= 6.76570

constants 1 IND(3)) i<= 6.76597

75
m) arg2 = multiple subscripted

variables

n) arg2 = multiple integer

constants of all same value

(.13, IND(P), IND(Q),

IND(R))

(.1, 10, 10, 10, 10, 10)

>= 12.3066 <= 12.3071 >= 37.9070 <= 37.9085

Complex Tests (relative error = .00004)

Specific features to be tested 1 Arguments Expected

1 (.argi argz . . .

;

Answer

a) arg2 = multiple integer 1 (-.5, 2+3, 6/3, 9-3) >= 65.9974

expressions <= 66.0026

b) arg2 = multiple non- integer 1 (-.2, 5/4, 3.3*4, 9.4+2) >= 44.4513

expressions |<= 44.4549

c) arg2 = multiple variables. 1 (.5, A+2, 4.5/C, 8, B) >= 7.91943

constants and <= 7.92007

expressions

d) use PRESENT -VALUE in an 1 TEMP=PRESENT -VALUE TEMP

:

expression 1 (.08, 2, 3) + 18 |>= 22.4229

|<= 22.4247

e) use PRESENT-VALUE in twice 1 TEMP=PRESENT -VALUE 1 TEMP

:

in an expression 1 (.03, -6, -4)+PRESENT- |>=-2. 09570

1 VALUE(0.2, 9) |<=-2. 09554

f) use PRESENT-VALUE in an 1 TEMP=PRESENT -VALUE 1 TEMP

:

expression that invokes 1 (PRESENT-VALUE(1, 2), 3) |>= 1.49994

itself |<= 1.50006

5.31 IF131A

a. Features Tested

This program tests the Intrinsic Function RANDOM, which returns a random number based on its argument (if any). The function is

applied to non-negative numbers. If an argument is given then it is

used as the seed value. All returned values should be in the range >= 0 and < 1. For a given seed value on a given implementation, the

sequence of pseudo- random numbers will always be the same. The

implementor will specify the subset of the domain of argument-1

values that will yield distinct sequence of pseudo-random numbers.

The subset must include the values from 0 through at least 32767.

FUNCTION RANDOM [ (argl)

]

76
b. Reference

Page A- 64

Section 2.35

c. Number of tests

12

d. Variables

A PICTURE S9(10)

P PICTURE S9(10)

Q PICTURE S9(10)

R PICTURE S9(10)

ARR

VALUE 4

VALUE 1 VALUE 3 VALUE 5 VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(8)V9(8)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument (s) in the table and then all

remaining arguments tested with the COMPUTE statement where

possible

1) COMPUTE identifier- 2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression

3) IF condition- 1 THEN

statement

ELSE

statement

Identifier- 2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Specific features to be tested

a) no argument

b) Z = integer constant

c) Z = integer variable

d) Z = subscripted int constant

e) Z = subscripted int variable

f) RANDOM used in an expression

Arguments

(argl)

(3)

(Q)

(IND(4))

(IND(A))

TEMP=RAND0M(2)+1

Expected

Answer

=>0, <1

=>0, <1

=>0, <1

=>0, <1

=>0, <1

1<=TEMP<2

77
g) RANDOM used twice in an expression

h) RANDOM used recursively

in an expression

i) use 0 as the seed

j) use 32767 as the seed

k) check that when same seed is

used, the same result is

obtained

1) Check that returned values

conform to a rectangular

distribution

TEMP=RAND0M(1)+

RAND0M(2)

TEMP= RANDOM (INTEGER

(100 * RANDOM(l)))

(0)

(32767)

TEMPI = RANDOM(l)

TEMP2 = RANDOM(l)

Specifics are yet to be

discussed with NCC

0<=TEMP<2

0<=TEMP<1

=>0, <=1

=>0, <=1

TEMP1=TEMP2

(both values

(should be

equal)

5.32 IF132A

a. Features Tested

This program tests the Intrinsic Function RANGE . which returns a value that is equal to the value of the maximum argument minus the

value of the minimum argument. The returned value is equal to the

greatest value of argument- 1 minus the least value of argument- 1.

The type of this function depends upon the argument types as follows

:

Argument Type Function Type

All arguments integer Integer

Numeric (some args . may be integer) Numeric

Argument- 1 must be class numeric.

FUNCTION RANGE (argl ...)

b. Reference

Page A-65

Section 2.36

c. Number of tests

16

d. Variables

A PICTURE S9(10)

B PICTURE S9(10)

C PICTURE S9(10)

D PICTURE S9(10)

E PICTURE S9(5)V9(5)

VALUE 5 VALUE 7 VALUE -4

VALUE 10

VALUE 34.26

78
T?t r iC i UKL C Q / R N ^70 t ^\ c>y )vy )

tT A T T TT?

- 0 o O . JZ

G

D T /^T'TTD tr by (, D ; vy {^D

)

T 7 A T n 17 VALUh 4 . Do

T T n

DT /^TT 7D T? r iOiUKh by ( J ; vy (. TT A 7 TIT? -J.J

M.

XT A T T T IT 1 0 r\r\r\n J/UUUU

IN "DT r^TTTD t? c: Q z' 1 n N D DUUUU

0 PICTURE S9(10) - jUUUU

p PICTURE S9(10) T 7 A 7 7 TT? vALUb 7i Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARGl PICTURE S9(10) VALUE 2 ARR VALUE "40537

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

must be used to test the features given below. Each type of

statement is to be allocated the first corresponding argument(s) in

the table and then all remaining arguments tested with the COMPUTE

statement where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION RANGE (argl , 1) >

10

procedure -name -

1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = 0 or .00002)

Specific features to be tested 1 Arguments 1 Expected

1 (argl ...) 1 Answer

a) Z = series of integer 1 (5, -2, -14, 0) 1 19

constants

b) Z = series of non- integer 1 (3.9, -0.3, 8.7, 100.2) |>=100.498

constants |<=100.502

79
c) Z = series of integer

variables

(A, B, C, D) 14

d) Z = series of non- integer (E, F, G) >= 42. 5791

variables | j<= 42. 5809

e) z = series of integer and | (10.2 -0.2, 5.6, -15.6) 25. 7992 non- integer constants | <= 25. 8005

f) z = series of integer and | (A, B, C, D, E, F, G) 42. 5791

non- integer variables | <= 42. 5809

g) z = a series of

subscripted constants

(IND(l), IND(2), IND(3)) 5

h) z = a series of

subscripted variables

IND(P), IND(Q), IND(R)) 3

i) z = ALL used as a subscript to reference

a table (IND(ALL)) 7

1

)

z = a series of medium to low (0.032, 0.019, 0.014, |>= 0.096998

magnitude constants -0.065) |<= 0.097002

k) z = a series of large (M, N, 0) 1 1080000

magnitude variables

1) z = series of same values (A, 5, A) 0

Complex Tests (relative error = 00002)

Specific features to be tested 1 Arguments Expected

(argl . .

.

)

Answer

a) RANGE used as part of 1 TEMP=RANGE(A,B)+78 |TEMP an expression 1

1 |>

|<=

= 79.9984

= 80.0160

b) RANGE used twice within 1 TEMP=RANGE(A,B)+ |TEMP an expression 1 RANGE(-2.6, -4.4,1) |>=<=

= 7

= 7 .39985

.40015

c) RANGE function that invokes 1 TEMP=RANGE(RANGE(6.8, |TEMP

itself 1 -6. 8), 4) |>== 9 .59981

|<== 9 .60019

5.33 IF133A

a. Features Tested

This program tests the Intrinsic Function REM which returns a numeric value that is the remainder of argument -1 divided by

argument- 2. The type of this function is numeric. The returned

value is specified by the expression:

REM(argl,arg2) = argl - (arg2 * FUNCTION INTEGER-PART (argl

/ arg2))

80
argiiment-1 and argument- 2 must be class numeric,

argument- 2 must not be zero.

FUNCTION REM (argl arg2)

b. Reference

Page A-66

Section 2.37

c. Number of tests

17

d. Variables

A PICTURE S9(10)

B PICTURE S9(5)V9(5)

C PICTURE S9(10)

D PICTURE S9(10)

ARG2 PICTURE S9(10)

TEMP PICTURE S9(10)

VALUE 5 VALUE 7.3(

VALUE -4

VALUE 7 VALUE 1

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

must be used to test the features given below. Each type of

statement is to be allocated the first corresponding argument(s) in

the table and then all remaining arguments tested with the COMPUTE

statement where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement

ELSE

statement

4) PERFORM procedure -name -1 UNTIL FUNCTION REM(5,arg2) >= 2

procedure -name

arg2 = arg2 + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

81
Simple Tests (relative error = 0 or .00002)

Specific features to be tested Arguments 1 Expected

(argl arg2) 1

1 Answer

a) argl 0 (0, 20) 1 0

b) argl=arg2 (both constants) (10.674, 10.674) |>=- 0. 000020

|<= 0. 000020

c) argl const, arg2 = var (2.5, A) |>= 2. 49995

|<= 2. 50005

d) argl var, arg2 = const (A, 2) 1

e) argl var, arg2 = var (B, A) |>= 2. 35995

|<= 2. 36005

f) argl < 0, arg2 < 0 (-11, -5) 1 -1

g) argl > 0, arg2 < 0 1 (11, -5)

1

1 h) argl < 0, arg2 > 0 1 (-11, 5)

1

-1

Complex Tests (relative error = .00002)

Specific leatures to be tested 1 Arguments 1 Expected

1 (argl arg2 ) 1

1 Answer

a) argl const, arg2 = expr 1 (0.89, B + 1) |>= 0. 889982

|<= 0. 890018

b) argl var , arg2 - expr 1 (B, C + 2.2) |>= 0. 159997

|<= 0. 160003

c) argl expr, arg2 = const 1 (3/2, .75) |>= -0. 000020

j<= 0. 000020

d) argl expr, arg2 = var 1 (8+6, B) |>= 6. 63987

|<= 6. 64013

e) argl expr, arg2 = expr 1 (C + 1, 2) |>= -1. 00002

|<= -0. 999980

f) argl REM Fxn, arg2 = var 1 (REM (D, A) , A) |>= 1. 99996

i<= 2. 00004

g) argl var, arg2 = REM Fxn 1 (C,REM (C, D)) i>= -0. 000020

i<= 0. 000020

h) argl REM Fxn, arg2 REM Fxn 1 (REM(9, 5),REM(D, 4)) i>= 0. 999980

i<= 1. 00002

5.34 IF134A

a. Features Tested

This program tests the Intrinsic Function REVERSE, which returns a character string of exactly the same length as argument- 1 and whose

characters are exactly the same as those of argument- 1, except that

they are in reverse order. The type of this function is

82
alphanumeric. Argument- 1 must be class alphabetic or alphanumeric

and must be at least one character in length. If argument -1 is a character string of length n, the returned value is a character

string of length n, such that for l<=J<=n, the character in position

j of the returned value is the character from position n-j+l of

argument- 1

FUNCTION REVERSE (argl)

b. Reference

Page A- 67

Section 2.38

c. Number of tests

13

d. Variables

A PICTURE A (10)

B PICTURE A(10)

C PICTURE X(10)

D PICTURE X(10)

E PICTURE X(10)

TEMPI PICTURE X(7)

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument (s) in the table and then all

remaining arguments tested with the MOVE statement where possible.

1) MOVE identifier-1 TO identifier-2

2) IF condition- 1 THEN

statement -1

ELSE

statement

Identifier-1 refers to a function invocation.

Identifier-2 must never be used as function invocation.

Condition- 1 refers to a conditional expression for which one of its operands is an Intrinsic Function.

VALUE "tumble"

VALUE "WEED"

VALUE "Was"

VALUE "4"

VALUE "And4"

VALUE "giZZard"

83
Specific features to be tested 1 Arguments Expected

! (argl) i Answer

a) Z = constant string of only

lower case alphabetic

characters

1 ("figure") 1 "erugif"

b) Z = constant string of only

upper case alphabetic

characters

1 ("CAPS") "SPAC"

c) Z = constant string of mixed

case alphabetic chars

1 ("highnLOW") "WOLnhgih"

d) Z = constant string of non- alphabetic characters

1 ("95") "59"

e) Z = constant string of

alphabetic and non- alphabetic characters

1 ("SisaNUMBER") "REBMUNasiS"

f) Z = variable string of all

lower case alphabetic

characters

1 (A) elbmut"

g) Z = variable string of all

upper case alphabetic

characters

1 (B) DEEW"

h) Z= variable string of mixed

case alphabetic chars

1 (C) saW"

Z = variable string of non- alphabetic characters

1 (D) n ^11

j) Z = variable string of

alphabetic and non- alphabetic characters

1 (E) 4dnA"

REVERSE used as part of an expression

1 TEMP=LENGTH(REVERSE(

1 "Homer"))

TEMP = 5

1) REVERSE used to invoke |TEMP1=REVERSE (REVERSE TEMP1=

itself j ("giZZard")) "giZZard"

m) REVERSE used twice in an expression

1 TEMP=LENGTH (REVERSE

(

1 " HOMER "

) ) -l-LENGTH ( REVERS E

1 ("Gizzard"))

TEMP = 12

5.35 IF135A

a. Features Tested

This program tests the Intrinsic Function SIN . which returns a numeric value that approximates the sine of angle or arc, expressed

in radians, that is specified by argument- 1. The type of this

function is numeric. Argument- 1 must be class numeric. The

returned value is the approximation of the sine of argument -1 and

is greater than or equal to -1 and less than or equal to 1.

84
FUNCTION SIN (argl)

b. Reference

Page A-68

Section 2.39

c. Number of tests

32

d. Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(5)V9(5) VALUE 14000.105

C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

PI PICTURE S9V9(17) VALUE 3.141592654

P PICTURE S9(10) VALUE 1 ARGl PICTURE S9(10) VALUE 3 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one the following COBOL statements, excluding PERFORM, be

used to test the features given below. Each type of statement is

to be allocated the first corresponding argument (s) in the table and

then all remaining arguments tested with the COMPUTE statement where

possible

1) COMPUTE identifier- 2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement

ELSE

statement

4) PERFORM procedure -name -1 UNTIL FUNCTION SIN (argl) < 0

procedure -name -

argl = argl - 1

Identifier- 2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

85
Simple Tests (relative error = .00002)

Specific features to be tested | Arguments

(argl)

1

1

1

Expected

Answer

a) Z _ 0 i (0) |>=- 0 000020

|<= 0 000020

b) Z _ PI i (PI) >=- 0 000020

|<= 0 000020

c) Z — -PI 1 (-PI) |>=- 0 000020

|<= 0 000020

d) Z = Values close to 0 | (0.001) |>= 0 000998

|<= 0 001000

e) Z a low magnitude non- | ( .00009) |>= 0 000089

integer constant | |<= 0 000090

( const < .0001 ) 1 f) Z a low magnitude non- | (A) |>=- 0 000040

integer variable | |<=- 0 000039

( var < .0001 ) | g) Z a variable subscripted | (IND(P)) |>=- 0 756817

variable | |<=- 0 756787

h) z a constant subscripted | (IND(4)) j>= 0 141117

variable | i<= 0 141123

Complex Tests (relative error = .00004)

Specific features to be tested 1 Arguments Expected

1 (argl) Answer

a) Z = PI/3 1 (PI / 3)

j<=

0

0

865990

866060

b) Z = PI/2 1 (PI / 2) |>=

|<=

0

1 99996000000

c) z = 3PI/2 1 ((3 * PI)/ 2) |>=

|<=

-1

-0

00000

999960

d) z = -PI/3 1 (-PI / 3) |>=

j<=

-0

-0

866060

865990

e) z = -PI/2 1 (-PI / 2) |>=

|<=

-1

-0

00000

999960

f) z = -3PI/2 I ((3 * -PI)/ 2) |>=

|<=

0

1 99996000000

g) z = Values close to PI/2 1 ((PI/2) - 0.001) |>=

|<=

0

1 99996000000

h) z = Values close to PI/3 1 ((PI/3) + 0.001) |>=

|<=

0

0

866489

866559

i) z = Values close to PI 1 (PI - 0.001) |>=

|<=

0

0

000874

001126

j) z = Values close to 3PI/2 1 (((3 * PI) / 2) + 0.001)

|<=

-1

-0

00000

999960

86
k) Z = Expr. with value close

to or equal to 0

1) Z = Expr. with value close

to or equal to PI/2

m) Z = Expr. with value close

to or equal to PI/3

n) Z = Expr. with value close

to or equal to PI

o) Z = Expr. with value close

to or equal to 3PI/2

p) Z = an integer expression

using constants only

q) Z = a non- integer expression

using constants only

r) Z = a non- integer expression

using variables only

s) Z = an integer expression

using variables and

constants

t) Z = a non- integer expression

using variables and

constants

u) SIN used as part of an expression

v) SIN function that invokes

itself (i.e SIN(SIN(x) ) )

where x may be a variable

or an expression

w) The SIN function applied

twice in an expression

(PI * (4 - 2) / 180)

( (PI / 2) - (PI / 180))

((PI / 3) - (PI / 180))

(PI + (PI / 180))

((PI * 272) / 180)

(4 / 2)

(3 / 2)

(PI - A)

(D / 100)

(PI / 180)

TEMP=SIN(PI)+1

TEMP=SIN(SIN(2))

TEMP=SIN(PI/3)+

SIN(-PI/3)

>= 0. 034898

<- 0. 034900

>- 0. 999807 <= 0. 999887 >= 0. 857132 <= 0. 857201

>=- 0. 017453

<=- 0. 017451

>=-0. 999430 <= 0 999350 >= 0 909261 <= 0 909333 >= 0 997454 <= u yy /D j4

-0 000040 <= -0 000039

,>= - \j <= -0 .543999

0 .017451 <= 0 .017453

TEMP

>= 0 . yy y you <= 1 .00000

TEMP >= 0 .789040 <= 0 .789104

TEMP >= -0 .000040 <= 0 .000040

5.36 IF136A

a. Features Tested

This program tests the Intrinsic Function SORT . which returns a numeric value that approximates the square root of argument- 1. The

type of this function is numeric. Argument -1 must be class numeric

and must be zero or positive. The returned value is the absolute

value of the approximation of the square root of argument- 1.

FUNCTION SQRT (argl)

b. Reference

Page A-69

Section 2.40

87
Number of tests

26

Variables

A PICTURE S9(5)V9(5) VALUE 0.00004

B PICTURE S9(5)V9(5) VALUE 14000.105

C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

E PICTURE S9(10) VALUE 7 F PICTURE S9(10) VALUE 6

P PICTURE S9(10) VALUE 1 ARGl PICTURE S9(10) VALUE 10

ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement-2

4) PERFORM procedure -name -1 UNTIL FUNCTION SQRT(argl) < 2.0

procedure - name -

1

argl = argl - 1

Identifier-2 must never be used as a function invocation.

Expression- 1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

88
Simple Tests (relative error = .00002)

Specific features to be tested | Arguments

(argl)

1

1

1

Expected

Answer

a) Z 0 1 (0) l>= 0 000000

1 |<= 0 000020

b) Z = 1 j (1) |>= 0 999980

1 ]<= 1 00002

c) Z = 4 1 (4) |>= 1 99996

1 |<= 2 00004

d) Z = values close to 0 | (.001) 1>= 0 031621

1 j<= 0 031623

e) Z values close to 1 | ( .999) l>= 0 999479

1 |<= 0 999519

f) Z = values close 4 | (4.01) |>= 2 00246

1 |<= 2 00254

g) Z = a large magnitude non- | (31409.84) l>= 177.224

integer constant | |<= 177.231

h) Z = a large magnitude integer

|

(860000) |>= 927.342

constant | |<= 927.379

i) Z a low magnitude non- | ( .00009) l>= 0 0094866

integer constant | |<= 0 0094870

j) Z a large magnitude non- | (B) |>= 118.320

integer variable | |<= 118.324

k) Z a large magnitude integer] (C) 316.222

variable | j<= 316.234

1) Z a low magnitude non- | (A) |>= 0 0063244

integer variable | j<= 0 0063246

m) Z a variable subscripted | (IND(P)) 1 99996

variable | |<= 2 00004

n) Z a constant subscripted | (IND(3)) 1 >= 2 23601

variable | |<= 2 23610

Complex Tests (relative error = .00004)

Specific features to be tested | Arguments

(argl)

Expected

Answer

a) Z = expr. with value close to

|

(9 - 8.9) |>= 0.316214

or equal to 0 | |<= 0.316240

b) Z = expr. with value close to

|

(8 / 2.1) 1.95172

or equal to 4 | |<= 1.95188

c) Z = an integer expression | (35 * 9) |>= 17.7475

using constants only | |<= 17.7489

d) Z = a non- integer expression | (9 / 7) |>= 1.13384

using constants only | |<= 1.13393

e) Z = an integer expression | (E + F) |>= 3.60541

using variables only | |<= 3.60569

89
f) Z = a non- integer expression

using variables only

g) Z = an integer expression

using constants and

and variables

h) Z = a non- integer expression

using constants and

variables

i) Z = SQRT function that

invokes itself using both

variables & expressions

j

) The SQRT function used twice

within an expression

k) check that x=(sqrt(x**2)

)

(D / E) |>= 11 .9517

|<= 11 .9527

C F - 3) >= 1 731 98

l<= 1- mil

(E * 2.3)

1|>= 4. 01232

|<= 4. 01264

TEMP=SQRT(SQRT(F))

1

1 TEMP

:

JO jUZ

|<= 1. 56514

TEMP=SQRT(6.5)+ 1 TEMP

:

SQRT(5.4) |>= 4. 87309

|<= 4. 87348

TEMP = SQRT(10)**2 1 TEMP

:

|>= 9. 99960

|<= 10 .0004

IF137A

a. Features Tested

This program tests the Intrinsic Function STANDARD - DEVIATION . which

returns a numeric value that approximates the standard deviation of

its arguments. The type of this function is numeric. Argument-1

must be class numeric. The returned value is the approximation of

the standard deviation of the argument-1 series. The returned value

is calculated as follows:

a) The difference between each argument-1 value and the

arithmetic mean of the argument-1 series is calculated

and squared.

b) The values obtained are then added together. This quantity

is divided by the number of values in the argument-1

series

.

c) The square root of the quotient obtained is then

calculated.

The returned value is the absolute value of this square root.

If the argument-1 series consists of only one value or if the

argument-1 series consists of all variable occurrences data items

and the total number of occurrences for all of them is one, the

returned value is zero.

90
FUNCTION STANDARD -DEVIATION (argl ...)

b. Reference

Page A- 70

Section 2.41

c. Number of tests

17

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE -4

D PICTURE S9(10) VALUE 10

E PICTURE S9(5)V9(5) VALUE 34.26

F PICTURE S9(5)V9(5) VALUE -8.32

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE -5.3

P PICTURE S9(10) VALUE 4

Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARR VALUE "40537"

ARG3 PICTURE S9(10) VALUE 2 IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression

3) IF condition- 1 THEN

statement

ELSE

statement-2

4) PERFORM procedure -name -1 UNTIL FUNCTION

STANDARD -DEVIATION (l,l,arg3) > 1

procedure -name -

arg3 = arg3 + 1

91
Identifier- 2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Spe cific features to be tested 1 Arguments Expected

1 (argl ...) Answer

a) Z series of integer

constants

1 (5, -2, -14, 0) >=

<=

6.97750

6.97778

b) Z = series of non- integer

constants

1 (3.9, -0.3, 8.7, 100. 2) <=

^1.7333

41.7350

c) Z = series of integer

variables

1 (A, B, C, D) >=<=

5.22005

5.22025

d) Z series of non integer

variables

1 (E, F, G, H) >=<=

16.8440

16.8447

e) Z series of integer and

non- integer constants

1 (10.2, -0.2, 5.6, -15 .6) >=

<=

9.73119

9.73158

f) Z series of integer and

non- integer variables

1 (A, B, C, D, E, F, G, H) >=

<=

12.4976

12.4981

g) Z a series of constant 1 (IND(l), IND(2), IND(3)) >= 2.16020

subscripted variables |<= 2.16028

h) Z a series of variable 1 (IND(P), IND(Q), IND(R)) |>= 1.63296

subscripted variables |<= 1.63302

i) Z ALL used as subscript

to reference a table

1 (IND(ALL)) i>=

|<=

2.31511

2.31521

j) Z a series of low 1 (0.00032, 0. 00019, |>= 0.028559

magnitude constants 1 0.00014, -0 .06574) |<= 0.028561

k) Z series of same values 1 (A, 5, A) |>=-

|<=

-0.000020

0.000020

Complex Tests (relative error = .00004)

Specific features to be tested

a) Z = mixture of expressions

and constants

b) Z = mixture of expressions

variables and consts

c) STANDARD -DEVIATION used

as part of an expression

Arguments

(argl . . .)

(2.6 -f 30, 4.5 * 2)

(E, 9 * A, 0, B / 2)

TEMP=STANDARD - DEVIATION

(A)+78

Expected

Answer

1>= 11.7995

|<= 11.8005

|>= 19.3556

i<= 19.3572

TEMP:

|>= 77.9969

|<= 78.0031

92
d) STANDARD -DEVIATION used

twice within an expression

e) STANDARD -DEVIATION used

recursively

TEMP=STANDARD- DEVIATION

( A , B ) +STANDARD - DEVIATION

(1,1)

TEMP=STANDARD - DEVIATION

( STANDARD - DEVIATION ( 0

,

0))

TEMP

:

>- 0.99996

<= 1.00004

TEMP:

>=-0. 000040

<= 0.000040

5.38 IF138A

a. Features Tested

This program tests the Intrinsic Function SUM , which returns a value

that is the sum of the arguments . The type of this function depends

upon the argument types as follows:

Argument Type Function Type

All arguments integer Integer

Numeric (some args . may be integer) Numeric

Argument- 1 must be class numeric.

The returned value is the sum of the arguments.

FUNCTION SUM (argl ...)

b. Reference

Page A-71

Section 2.42

c. Number of tests

17

d. Variables

A PICTURE S9(10) VALUE 5 B PICTURE S9(10) VALUE 7 C PICTURE S9(10) VALUE -4

D PICTURE S9(10) VALUE 10

E PICTURE S9(5)V9(5) VALUE 34.26

F PICTURE S9(5)V9(5) VALUE -8.32

G PICTURE S9(5)V9(5) VALUE 4.08

H PICTURE S9(5)V9(5) VALUE -5.3

M PICTURE S9(10) VALUE 320000

N PICTURE S9(10) VALUE 650000

0 PICTURE S9(10) VALUE -430000

P PICTURE S9(10) VALUE 1 Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5

93
ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression- 1 ALSO expression2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION SUM(argl,l) > 10

procedure -name1

argl = argl + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = 0 or .00002)

Specific features to be tested j Arguments Expected

1 (argl ...) Answer

a) Z = series of integer

constants

1 (5, -2, -14, 0) 11

b) Z = series of non- integer

constants

1 (3.9, -0.3, 8.7 , 100. 2) >=<=

112.498

112.502

c) Z = series of integer

variables

1 (A, B, C, D) 18

d) Z = series of non integer

variables

1 (E, F, G, H) |>=

|<=

24.7195

24.7205

e) Z = series of integer and

non- integer constants

1 (10.2, -0.2, 5. 6, -15 .6) <=

0.000020

0.000020

f) Z = series of integer and

non- integer variables

1 (A, B, C, D, E, F, G, H) |>=

i<=

42.7191

42.7209

g) Z = a series of constant 1 (IND(l), IND(2) , IND(3)) 9

subscripted variables

94
n) Z = a series of variable | (IND(P), IND(Q), IND(R)) 16

subscripted variables ] 1) Z = ALL used as subscript | to reference a table (IND(ALL)

)

1 19

j) Z = a series of medium to low (0.032, 0.019, 0.014 > |>=-0. 000020

magnitude constants -0.065) <= 0.000020

k) Z = a series of large (M, N, 0) 1 540000

magnitude variables

Complex Tests (relative error = 00002)

Specific features to be tested Arguments 1 Expected

(argl . .

.

)

1 Answer

a) Z = mixture of expressions (z.6 + JO, 4.5 * 2) 1 /.I o o o

1 >= M-i . y

/

and constants 1 <= 4i . bUUo

b) Z = mixture of expressions (E, 9 * A, B / 2) 1 0 O "7 C O O

1 >= OZ

.

/DOi

variables and consts 1 <= O Z . / D 1

D

c) SUM used as part of an TEMP=SUM(A, B)+/o 1 1 EMF

expression 1 ^ on n n o o

1 >= yy . y y OZ

1 <= yu.uolo

d) SUM used twice within an TEMP=SUM ( A , B ) +SUM ( • 2 .6, 1 i EMF

expression 1 / / \ -4.4) |>= 4.99990

1 <= J . UUUiU

e) SUM function used 1 TEMP=SUM(SUM(6.8, -6. 8), 1 TEMP

recursively |>= 3.99992

|<= 4.00008

5.39 IF139A

a. Features Tested

This program tests the Intrinsic Function TAN , which returns a numeric value that approximates the tangent of an angle or arc,

expressed in radians, that is specified by argument- 1. The type of

this function is niomeric. Argument- 1 must be class numeric. The

returned value is the approximation of the tangent of argument-1.

FUNCTION TAN (argl)

b . Reference

Page A- 72

Section 2.43

c. Number of tests

32

95
d. Variables

A PICTURE S9(5)V9(5) VALUE -0.00004

B PICTURE S9(5)V9(5) VALUE 14000.105

C PICTURE S9(10) VALUE 100000

D PICTURE S9(10) VALUE 1000

PI PICTURE S9V9(17) VALUE 3.141592654

P PICTURE S9(10) VALUE 1 ARGl PICTURE S9(10) VALUE 1 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9

TEMP PICTURE S9(5)V9(5)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument (s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic -expression1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition-1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION TAN(argl) < 0

procedure -name -

1

argl = argl - .25

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition-1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested

a) Z = 0

b) Z = PI

Arguments

(argl)

(0)

(PI)

Expected

Answer

>=-0. 000020 <= 0.000020

>=-0. 000020 <= 0.000020

96
c) Z = -PI

d) Z = Values close to 0

e) Z = a low magnitude non- integer constant

( const < .0001 ) f) Z = a low magnitude non- integer variable

( var < .0001 ) g) Z = a variable subscripted

variable

h) Z = a constant subscripted

variable

( -PI) 1 >—

0 000020

|<- 0 000020

(.001) 1 0 000999

|<= 0 001000

( .00009) |>- 0 000089

1 <~ 0 000090

(A) 1 0 000040

1 -0 000039

(IND(P)) 1>= 1 . 15780

|<= 1 . 15784

(IND(5)) |>= 0 .871430 <= 0 . 871464

Complex Tests (relative error = .00004)

Specific features to be tested Arguments

1 (argl)

j Answer

a) Z PI/4 1 (PI / 4) |>= <=

0.

1.

999960

00004

b) Z = 3PI/4 1 ((3 * PI) / 4) |>=-

|<=-

1.

0.

00004

999960

c) z = 5PI/4 1 ((5 * PI) / 4) |>=

|<=

0.

1.

999960

00004

d) z 7PI/4 1 ((7 * PI) / 4) |>=-

|<=-

1.

0.

00004

999960

e) z -PI/4 1 (-PI / 4) |>--

|<=-

1.

0.

00004

999960

f) z -3PI/4 1 ((3 * -PI)/ 4) |>=

|<=

0.

1.

999960

00004

g) z -5PI/4 1 ((5 * -PI) / 4) |>=-

|<=-

10

00004

999960

h) z -7PI/4 1 ((7 * -PI) / 4) |>=

|<=

0

1 999960

00004

i) z Values close to PI/4 1 ((PI / 4) - .001) |>=

|<=

0

0

997961

998041

j) z Values close to PI 1 (PI + .001) |>= 0 000S74

|<= 0 001126

k) z Expr . with value close

to or equal to 0

1 (1 / 180) |>=

|<=

0

0

0055554

0055558

1) z Expr. with value close

to or equal to PI/4

1 ((PI / 4) - (PI / ISO)) |>=

|<=

0

0

965649

965727

m) z Expr. with value close

to or equal to PI

1 (PI + ((2 * PI) / ISO)) |>=

|<=

0

0

.034919

.034921

n) z Expr. with value close

to or equal to 3PI/4

|(((PI * 3)/4)+(l/lS0)) |>=

1<=

0

-0

.988990

.988910

o) z Expr. with value close

to or equal to 5PI/4

|(((PI * 5)/4) - (2/lSO)) |>=

|<=

0

0

.977982

.978060

Expected

97
p) Z = an integer expression | (4 / 2) |>=- 2. 18512

using constants only | |<=- 2. 18494

q) z = a non- integer expression ] (3 / 2) |>= 1^ . 1008

using constants only | |<= .1020

r) z = a non- integer | (PI - A) 1 0

.

000086

expression using | |<= 0. 000166

variables only | s) z = an integer expression | (D / 100) [>= 0

.

648334

using variables and | |<= 0. 648386

constants | t) z = a non- integer | (PI / 180) |>= 0. 017454

expression using | |<= 0. 017456

variables & constants | u) TAN used as part of an | TEMP=TAN(PI)+1 1 TEMP

:

expression | |>= 0. 999960

|<= 1. 00004

v) TAN function used recursively] TEMP=TAN(TAN(2)

)

|>= 1. 41786

(i. 5 (TAN(TAN(x))) , where x j |<= 1. 41798

may- be a variable or an | expression 1 w) The TAN function used | TEMP=TAN(PI/3)+ 1 TEMP

:

twice in an expression | TAN(-PI/3) |>=- 0. 000040

|<= 0. 000040

IF140A

a. Features Tested

This program tests the Intrinsic Function UPPER- CASE . which returns

a character string that is the same length as argument- 1 with each

lowercase letter replaced by the corresponding uppercase letter.

The type of this function is alphanumeric. Argument- 1 must be class

alphabetic or alphanumeric and must be at least one character in

length. The character string returned has the same length as argument- 1

.

FUNCTION UPPER-CASE (argl)

b. Reference

Page A-73

Section 2.44

c. Number of tests

13

98
d. Variables

A PICTURE A(10)

B PICTURE A(10)

C PICTURE X(10)

D PICTURE X(10)

E PICTURE X(10)

TEMP PICTURE S9(10)

VALUE "tumble"

VALUE "WEED"

VALUE "Was"

VALUE "4"

VALUE "And4"

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument(s) in the table and then all

remaining arguments tested with the MOVE statement where possible.

1) MOVE identifier- 1 TO identifier2

1) IF condition- 1 THEN

statement1

ELSE

statement2

Identifier- 1 refers to a function invocation.

Identifier-2 must never be used as function invocation.

Condition- 1 refers to a conditional expression for which one of its operands is an Intrinsic Function.

Specific features to be tested

a) Z = constant string of only

lower case alphabetic

characters

b) Z = constant string of only

upper case alphabetic

characters

c) Z = constant string of mixed

case alphabetic chars

d) Z = constant string of non- alphabetic characters

e) Z = constant string of

alphabetic and non- alphabetic characters

f) Z = variable string of all

lower case alphabetic

characters

g) Z = variable string of all

upper case alphabetic

characters

Arguments

(argl)

("figure")

("CAPS")

("highnLOW")

("95")

("SisaNUMBER")

(A)

(B)

Expected

Answer

FIGURE

CAPS

HIGHNLOW

95

SISANUMBER

TUMBLE

WEED

99
h) Z = variable string of mixed

case alphabetic chars

i) Z = variable string of non- alphabetic characters

j) Z = variable string of

alphabetic and non- alphabetic characters

k) UPPER- CASE used as part

of an expression

1) UPPER-CASE used recursively

m) UPPER- CASE used twice in an expression

(C)

(D)

(E)

TEMP=LENGTH (UPPER- CASE

("Homer"))

TEMP=UPPER- CASE (UPPERCASE ("giZZard"))

TEMP=LENGTH (UPPER- CASE

( "HOMER" )

) +LENGTH (UPPER

CASE( "gizzard"))

WAS

4

AND4

TEMP = 5

GIZZARD

TEMP = 12

IF141A

a. Features Tested

This program tests the Intrinsic Function VARIANCE, which returns

a numeric value that approximates the variance of its arguments.

The type of this function is numeric. Argument- 1 must be class

numeric. The returned value is the approximation of the variance

of the argument- 1 series and it is defined as the square of the

STANDARD DEVIATION of the argument -1 series. If the argument -1

series consists of only one value, or if the argument-1 series

consists of all variable occurrence data items and the total number

of occurrences for all of them is one, the returned value is zero.

VARIANCE (argl ...) = FUNCTION STANDARD- DEVIATION (argl ...))**2

b. Reference

Page A- 74

Section 2.45

c. Number of tests

17

d. Variables

A PICTURE

B PICTURE

C PICTURE

D PICTURE

E PICTURE

F PICTURE

G PICTURE

H PICTURE

S9(10)

S9(10)

S9(10)

S9(10)

S9(5)V9(5)

S9(5)V9(5)

S9(5)V9(5)

S9(5)V9(5)

VALUE 5 VALUE 7 VALUE -4

VALUE 10

VALUE 34.26

VALUE -8.32

VALUE 4.08

VALUE -5.3

100
P PICTURE S9(10) VALUE 4

Q PICTURE S9(10) VALUE 3 R PICTURE S9(10) VALUE 5 ARG3 PICTURE S9(10) VALUE 2 ARR VALUE "40537"

IND OCCURS 5 TIMES PICTURE 9 TEMP PICTURE S9(10)

e. Statements structure

At least one of the following COBOL statements, excluding PERFORM,

be used to test the features given below. Each type of statement

is to be allocated the first corresponding argument(s) in the table

and then all remaining arguments tested with the COMPUTE statement

where possible.

1) COMPUTE identifier-2 = arithmetic-expression-1

2) EVALUATE expression-1 ALSO expression-2

3) IF condition- 1 THEN

statement1

ELSE

statement2

4) PERFORM procedure -name -1 UNTIL FUNCTION

VARIANCE(l,l,arg3) > 3

procedure -name -

1

arg3 = arg3 + 1

Identifier-2 must never be used as a function invocation.

Expression-1 and expression-2 refers to expressions in which

one of its operands is an Intrinsic Function.

Condition- 1 refers to a conditional expression containing

arithmetic expressions for which one of its operands is an Intrinsic Function.

Simple Tests (relative error = .00002)

Specific features to be tested Arguments

(argl ...)

a) Z = series of integer

constants

1 (5, -2 » * 14, 0) |>=

|<=

48.6865

48.6885

b) Z = series of non- integer

constants

1 (3. 9, -0. 3, !3.7, 100.2) |>=

|<=

1741.70

1741.77

c) Z = series of integer

variables

1 (A, B, c, D) |>=

|<=

27.2494

27.2505

d) Z = series of non integer

variables

1 (E, F, G, H)

|<=

283.728

283.740

e) Z = series of integer and

non- integer constants

1 (10 .2, -0 .2, 5.6 -15.6) |>=

|<=

94.6981

94.7019

Expected

Answer

101
f) Z = series of integer and 1 (A, B, C, D, E, F, G, H) >= 156.194

non- integer variables |<= 156.200

g) Z = a series of 1 (IND(l), IND(2) , IND(3)) j>= 4 66657

subscripted constants |<= 4 66675

h) z = a series of 1 (IND(P), IND(Q) , IND(R)) l>= 2 66661

subscripted variables |<= 2 66671

i) z = ALL used as a subscript

to reference a table

1 (IND(ALL)) |>= 5 35989

|<= 5 36011

j) z = a single value 1 (0.032) |>= -0 000020

|<= 0 000020

k) z = series of same values 1 (A, 5, A) |>= -0 000020

|<= 0 000020

Complex Tests (relative error 00004)

Specific features to be tested 1 Arguments 1 Expected

1 (argl ...) 1 Answer

a) VARIANCE used as part of 1 TEMP=VARIANCE(A,B)+78 1 TEMP

:

an expression |>= 78.9968

|<= 79.0031

b) Z = mixture of expressions 1 (2.6 + 30, 4.5 * 2) |>= 139.234

and constants j<= 139.245

c) Z = mixture of expressions 1 (E, 9 * A, 0, B / 2) |>= 374.658

variables and consts |<= 374.688

d) VARIANCE used twice within 1 TEMP=VARIANCE(A,B)+ 1 TEMP

:

an expression 1 VARIANCE (1,1) |>= 0.999960

|<= 1.00004

e) VARIANCE used recursively 1 TEMP=VARIANCE( VARIANCE 1 TEMP

:

1 (0),0) |>=-0. 000040

|<= 0.000040

IF142A

a. Features Tested

This program tests the Intrinsic Function WHEN -COMPILED . which

returns the date and time the program was compiled as provided by

the system on which the program was compiled. The type of this

function is alphanumeric. For more information related to the

returned value see Pages A-75 and A-76 of X3.23A-1989, "INTRINSIC

FUNCTION MODULE ADDENDUM TO AMERICAN NATIONAL STANDARD COBOL,

X3. 23-1985.

102
FUNCTION WHEN -COMPILED

b. Reference

Page A-75

Section 2.46

c. Number of tests

2

d. Variables

TEMPI PICTURE X(21)

TEMP2 PICTURE X(21)

e. Statements structure

At least one of the following COBOL statements must be used to test

the features given below. Each type of statement is to be allocated

the first corresponding argument(s) in the table and then all

remaining arguments tested with the MOVE statement where possible.

1) MOVE identifier-1 TO identifier-2

2) IF condition- 1 THEN

statement1

ELSE

statement -2

Identifier-1 refers to a function invocation.

Identifier-2 must never be used as function invocation . Condition- 1 refers to a conditional expression for which one of its operands is an Intrinsic Function.

Specific features to be tested

a) check that the range is valid

|

b) check again to make sure the same time is returned as first function call

Arguments

TEMP1=WHEN- COMPILED

TEMP2=WHEN- COMPILED

Expected

Answer

TEMPl=time

TEMP2-=>TEMP1

103
6 ACKNOWLEDGMENTS

The authors wishes to acknowledge Mr. John Cugini and Ms. Kathryn Miles from

NIST for their technical suggestions and review of this paper.

Acknowledgments are also in order for Mr. Dave Bamber and Mr. Gerald Bermingham

from the National Computer Centre in England for their work in translating the

specifications into COBOL code.

Finally we would like to acknowledge the work of Ms. Mabel Vickers for all her

technical suggestions and review of an earlier version of these specifications.

104
REFERENCES

Federal Information Processing Standards Publication (FTPS PUB) 21-3.

COBOL . National Institute of Standards and Technology, Computer System

Laboratory, January 1990

American National Standard Programming Language COBOL. ANSI X3. 23 -1985.

ISO 1989-1985 . American National Standards Institute, New York, NY,

September 1985

Intrinsic Function Module Addendum to American National Standard COBOL

X3 23A-1989 . American National Standards Institute, New York, NY, October

1988

Programming Procedures Manual for the 1978 Fortran Compiler Validation

System . Version 2.0, Report FCTC-81-46, Federal Compiler Testing Center,

General Services Administration, March 1982

Compiler Validation Procedures . National Institute of Standards and

Technology, Gaithersburg, MD, February 1990

Cugini , John V. "Specifications and Test Methods for Numeric Accuracy in

Programming Language Standard," NBS Special Publication 500-77, National

Bureau of Standards (U.S.), Gaithersburg, MD, June 1981

Ambrose, William G. College Algebra and Trigonometry . Macmillan Publishing

Co., Inc., New York, NY, 1977, 201-399

Grady, Michael D., Beckenbach Edwin F., and Wooton William Precalculus . Wadsworth Publishing Company, Bellmont, CA, 1980, 166-255

105

NiST-1 14A U.S. DEPARTMENT OF COMMERCE

(REV. 3-90) NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY

1. PUBUCATION OR REPORT NUMBER

NIST/SP-500/203

BIBLIOGRAPHIC DATA SHEET

2. PERFORMING ORGANIZATION REPORT NUMBER

3. PUBUCATION DATE July 1992

4. TITLE AND SUBTITLE

Conformance Test Specifications for COBOL Intrinsic Function Module

5. AUTHOR(S)

Carmelo Montanez-Rivera and L. Arnold Johnson

6. PERFORMING ORGANIZATION (IF JOINT OR OTHER THAN NIST, SEE INSTRUCTIONS)

U.S. DEPARTMENT OF COMMERCE

NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY

GAITHERSBURG, MD 20699

7. CONTRACT/GRANT NUMBER

8. TYPE OF REPORT AND PERIOD COVERED

Final

9. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (STREET, CITY, STATE, ZIP)

Same as item #6

10. SUPPLEMENTARY NOTES

11. ABSTRACT (A 200-WORD OR LESS FACTUAL SUMMARY OF MOST SIGNIFICANT INFORMATION. IF DOCUMENT INCLUDES A SIGNIFICANT BIBUOGRAPHY OR

UTERATURE SURVEY, MENTION IT HERE.)

This document contains test specifications for the COBOL Intrinsic

Functions Module of the Federal Information Processing Standard (FIPS)

Programming Language COBOL, FIPS PUB 21-3. It serves as a reference

manual and as a user's guide for the COBOL Intrinsic Function Module

Tests in the 1985 COBOL Compiler Validation System. The tests are used

by the National Institute of Standards and Technology (NIST) to test

COBOL implementations for conformance to COBOL,

Tests are divided into two major categories, Simple Tests and Complex

Tests . A Simple test uses a single entity as the argument, i.e., a constant or a literal by itself. Complex tests take as an argument

entities such as expressions or other Intrinsic Functions. The nature

of argiaments for the Complex tests will most likely have an effect on the accuracy of the expected value. This effect may be compensated by

allowing a greater error margin for such tests.

The testing of language processors to determine the degree to which they

conform to FIPS may be required by the Government departments and

agencies in accordance with the FIPS, the Federal Information Resources

Management Regulation 201.13 and 201.39, and the associated Federal ADP

and Telecommunications Standards Index.

12. KEYWORDS (6 TO 12 ENTRIES; ALPHABETICAL ORDER; CAPITALIZE ONLY PROPER NAMES; AND SEPARATE KEY WORDS BY SEMICOLONS)

ANSI; argiament; COBOL; complex tests; Intrinsic Function; simple tests

13. AVAILABIUTY UNUMITED

FOR OFFICIAL DISTRIBUTION. DO NOT RELEASE TO NATIONAL TECHNICAL INFORMATION SERVICE (NTIS). ORDER FROM SUPERINTENDENT OF DOCUMENTS, U.S. GOVERNMENT PRINTING OFFICE, WASHINGTON, DC 20402. ORDER FROM NATIONAL TECHNICAL INFORMATION SERVICE (NTIS). SPRINGFIELD, VA 22161.

14. NUMBER OF PRINTED PAGES

111

15. PRICE

ELECTRONIC FORM

* U.S. G.P.0.:1992-311-891:60489

ANNOUNCEMENT OF NEW PUBLICATIONS ON

COMPUTER SYSTEMS TECHNOLOGY

Superintendent of Documents

Government Printing Office

Washington, DC 20402

Dear Sir:

Please add my name to the announcement list of new publications to be issued in the series: National Institute of Standards and Technology Special Publication 500-.

Name

Company

Address

City State Zip Code

(Notification key N-503)



lylJ.LjJ^ Technical Publications

Periodical

Journal of Research of the National Institute of Standards and Technology— Reports NIST

research and development in those disciplines of the physical and engineering sciences in which

the Institute is active. These include physics, chemistry, engineering, mathematics, and computer

sciences.

Papers cover a broad range of subjects, with major emphasis on measurement methodology and

the basic technology underlying standardization. Also included from time to time are survey

articles on topics closely related to the Institute's technical and scientific programs. Issued six times a year.

Nonperiodicals

Monographs— Major contributions to the technical literature on various subjects related to the

Institute's scientific and technical activities. Handbooks — Recommended codes of engineering and industrial practice (including safety codes)

developed in cooperation with interested industries, professional organizations, and regulatory

bodies.

Special Publications — Include proceedings of conferences sponsored by NIST, NIST annual

reports, and other special publications appropriate to this grouping such as wall charts, pocket

cards, and bibliographies.

Applied Mathematics Series— Mathematical tables, manuals, and studies of special interest to

physicists, engineers, chemists, biologists, mathematicians, computer programmers, and others

engaged in scientific and technical work.

National Standard Reference Data Series — Provides quantitative data on the physical and chemical

properties of materials, compiled from the world's literature and critically evaluated. Developed

under a worldwide program coordinated by NIST under the authority of the National Standard

Data Act (Public Law 90-396). NOTE: The Journal of Physical and Chemical Reference Data

(JPCRD) is published bimonthly for NIST by the American Chemical Society (ACS) and the

American Institute of Physics (AIP). Subscriptions, reprints, and supplements are available from

ACS, 1155 Sixteenth St., NW., Washington, DC 20056.

Building Science Series — Disseminates technical information developed at the Institute on building

materials, components, systems, and whole structures. The series presents research results, test methods, and performance criteria related to the structural and environmental functions and the

durability and safety characteristics of building elements and systems.

Technical Notes — Studies or reports which are complete in themselves but restrictive in their treatment of a subject. Analogous to monographs but not so comprehensive in scope or definitive

in treatment of the subject area. Often serve as a vehicle for final reports of work performed at NIST under the sponsorship of other government agencies.

Voluntary Product Standards— Developed under procedures published by the Department of

Commerce in Part 10, Title 15, of the Code of Federal Regulations. The standards establish

nationally recognized requirements for products, and provide all concerned interests with a basis

for common understanding of the characteristics of the products. NIST administers this program

as a supplement to the activities of the private sector standardizing organizations.

Consumer Information Series— Practical information, based on NIST research and experience,

covering areas of interest to the consumer. Easily understandable language and illustrations provide useful background knowledge for shopping in today's technological marketplace.

Order the above NIST publications from: Superintendent of Documents, Government Printing Office,

Washington, DC 20402.

Order the following NIST publications— FIPS and NISTIRs—from the National Technical Information

Service, Springfield, VA 22161.

Federal Information Processing Standards Publications (FIPS PUB) — Publications in this series

collectively constitute the Federal Information Processing Standards Register. The Register serves

as the official source of information in the Federal Government regarding standards issued by

NIST pursuant to the Federal Property and Administrative Services Act of 1949 as amended,

Public Law 89-306 (79 Stat. 1127), and as implemented by Executive Order 11717 (38 FR 12315,

dated May 11, 1973) and Part 6 of Title 15 CFR (Code of Federal Regulations).

NIST Interagency Reports (NISTIR)— A special series of interim or final reports on work

performed by NIST for outside sponsors (both government and non-government). In general,

initial distribution is handled by the sponsor; public distribution is by the National Technical

Information Service, Springfield, VA 22161, in paper copy or microfiche form.