Skip to main content

Problem:

Does Mainframe Express have a way to assure a DISPLAY Statement for Signed COMPUTATIONAL field produces the same format as is output by the Mainframe IBM COBOL Compiler? We have an application support team that expected the test results of a DISPLAY Statement in MFE to match the same output format as produced by the mainframe IBM COBOL Compiler. Even though the mainframe program's output remained consistent, some level of confusion occurred on the application support Team because they expected the result to exactly

match that of MFE.

We tried several options but nothing would give us equivalent output.

Some sample fields and output are shown here:

WORKING-STORAGE SECTION.

01  GENERATED--FLAGS.

    05  SQLCODE         PIC S9(9) COMPUTATIONAL.

    MOVE 152 to SQLCODE.

    DISPLAY 'SQLCODE: ' SQLCODE.

    MOVE -813 TO SQLCODE.

    DISPLAY 'SQLCODE: ' SQLCODE.

               

The MFE version showed:

  

SQLCODE1: 0000000152

SQLCODE1: -0000000813

The Mainframe version showed this in the SYSOUT:

SQLCODE: 000000152       

SQLCODE: 00000081L       

Resolution:

This is not a bug in Mainframe Express.

We have carried the same basic behavior for many years in Mainframe Express (and even as far back as our Workbench days). I don't foresee Micro Focus wanting to change this behavior. This requires some explanation.

We do use mainframe values for sign bytes for data in fields that are used for arithmetic operations and file I/O, but we change them for DISPLAY purposes.

From the MFE Online Help reference this entry - Got to the Help, Contents tab, Reference, Cobol Language,

Part 1: Concepts, Concepts of the Cobol Language, Class and Category of Data, Algebraic Signs. Notice the entry saying:

Algebraic signs fall into two categories:

- operational signs, which are associated with signed numeric data items and signed numeric literals to indicate their algebraic properties

- Editing signs, which appear on edited reports to identify the sign of the item

Next click on the link in the Help for 'Selection of Character Representation and Radix' in the paragraph following the above statements. The Help left hand pane show you where we are in the Help. Either page down or select the next entry 'DISPLAY format'. Notice the chart labeled as 'Table 5'. This lists the values for positive and negative numbers. These values are used for all

arithmetic operations. But when using these values for DISPLAY purposes, they are displayed as their algebraic numeric equivalent and a sign symbol is added to the output.

Quoting from the COBOL ANSI85 Standard, ANSI X3.23.1985, we find this entry:

Page IV-16 4.3.5 Algebraic Signs

Algebraic signs fall into two categories:

operational signs, which are associated with signed numeric  data items and signed numeric literals to indicate their  algebraic properties; and editing signs, which appear  (e.g.) on edited reports to identify the sign of the item.

The SIGN clause permits the programmer to state explicitly the location of the operational sign. This clause is optional;  if it is not used, operational signs will be represented  as defined by the implementor.

  

IBM says this:

  Enterprise Cobol for z/OS, Language Reference

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr31/5.1.6.11?DT=20060329140556

5.1.6.11 Operational signs

Operational signs are associated with signed numeric items, and indicate their algebraic properties. The internal representation of an algebraic sign depends on the item's USAGE clause, its SIGN clause (if present), and the operating environment. (For further details about the

internal representation, see the Enterprise COBOL Programming Guide.) Zero is considered a unique value regardless of the operational sign. An unsigned field is always assumed to be either positive or zero.

Enterprise Cobol for z/OS, Programming Reference

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg32/1.3.4.7?DT=20061117131343

See Table 6

Micro Focus shows a similar description in our Help as already described above. In the 'Selection of

Character Representation And Radix', one can see table 5 and this wording under 'DISPLAY Format' :

If the data item is signed and the sign is specified as SEPARATE,  then the sign is held as a separate single COBOL character,  additional to the digits, either plus ( ) or minus (-) as necessary.

If the data item is signed and no SIGN clause applies, the numeric  sign is incorporated into the trailing digit, unless the NUMERIC SIGN  clause is specified in the Special-Names paragraph. If the SIGN  clause is specified in a data description entry, the NUMERIC SIGN  clause, if specified, is ignored for that entry.  

So this all means that Micro Focus is working as designed and meets the ANSI Standards because we are 'the implementor' in this environment.

Old KB# 2487

#MFDS
#EnterpriseDeveloper