Wednesday, December 16, 2015

COBOL Programming - Tip

Tip #1 

In a Tandem COBOL program, always use ENTER "COBOL_COMPLETION_" USING 1 
to abend a program. 

This preserves the call stack in the ZZSAnnnn saveabend file.

Tip#2

When you process information within a field with a known structure don’t use Reference Modification.


Make a REDEFINES of the field using self-explaining named fields, just to be sure that during maintenance not all the references should be changed.

Tip #3

Do not use the LINKAGE SECTION as working area. 

Tip#4

Use  ?SOURCE standard .
The exception is the use of the replacing option, then  “COPY” must be used. Explanation:
-          ?SOURCE is needed for SQL pre-compile options
-          COPY knows the replacing option ?SOURCE doesn’t.
-          COPY knows default library’s when you use ?SOURCE you should always give the needed library.
?SOURCE could contain library text (source directive could be nested, eq SQL statements) COPY can’t handle this

No comments: