Debug Tool support for COBOL 5.1: Data types allowed in MOVE and comparisons
TFors 120000MDQM Visits (5721)
This is the sixth in a series of blog entries on the subject of debugging IBM Enterprise COBOL for z/OS V5.1 using Debug Tool. These blog entries point out some of the improvements you'll see compared to debugging earlier versions of Enterprise COBOL.
This blog entry is regarding Debug Tool's support for COBOL data types. With previous versions of COBOL there were several restrictions on which data types were supported in the various Debug Tool commands. In particular, commands which perform assignment, such as MOVE, and commands which do comparisons, such as IF, had several limitations in the types of operands that could be used.
With COBOL 5.1, virtually all of these restrictions have been eliminated - the support in Debug Tool is much more complete and compatible with the COBOL language itself.
Here's a simple COBOL program to illustrate some of the improvements:
IDENTIFICATION DIVISION. PROGRAM-ID blog. DATA DIVISION. WORKING-STORAGE SECTION. 77 VAR1 PIC 99 USAGE BINARY VALUE 44. 77 VAR2 PIC 99 USAGE DISPLAY. PROCEDURE DIVISION. MOVE VAR1 TO VAR2 STOP RUN. END PROGRAM blog.
Note that VAR1 is a binary data item, while VAR2 is zoned.
With COBOL V4.2 it is not possible to do assignment between these variables, nor do comparisons:
MOVE VAR1 TO VAR2 ; VAR2 contains incompatible data type. IF ( VAR1 = VAR2 ) LIST "equal" ; END-IF ; VAR1 contains incompatible data type. Comparison in IF command was invalid. The command was ignored. COBOL V5.1 With COBOL V5.1, these limitations have been removed and the commands now work as expected: LIST ( VAR1, VAR2 ) ; VAR1 = 00044 VAR2 = .. MOVE VAR1 TO VAR2 ; LIST ( VAR1, VAR2 ) ; VAR1 = 00044 VAR2 = 44 IF ( VAR1 = VAR2 ) LIST "equal" ; END-IF ; equal
These are just a couple of examples - in general you will find that with COBOL 5.1, a large number of limitations have been removed and you can now do assignment and comparisons in Debug Tool using the same data types that the COBOL language supports.