COBOL

NOTE: This facility might be dropped. It was in the original MANASYS product, but it is fraught with error possibilities and a much better solution is to use CALL.

FUNCTION

To introduce COBOL sentences directly into the generated program.

FORMAT

COBOL; 

      COBOL-text;

END COBOL;

FUNCTION

The COBOL-text is inserted into the generated program at the point in the Procedure Division at which the COBOL statement appears. There is no provision to insert Identification, Environment or Data Division COBOL.

 

WARNING:†† COBOL/END COBOL should only be used after all other alternatives have been considered and found wanting. It is very easy to interfere with the logic that Jazz generates, introducing errors into your program that Jazz canít detect. If youíre lucky these errors will cause an immediate abend when the program runs and no real harm will be done, but you could end up updating or deleting records in ways that you didnít intend. To use this feature you need to be an experienced COBOL programmer as well as an experienced Jazz programmer, and you should examine the COBOL code produced by Jazz before running it to ensure that it will produce the results that you want.So if you can, find a Jazz solution, or CALL a separately-written COBOL subprogram.If you must use a COBOL/END COBOL block, it is probably best to put this into a PARAGRAPH.

 

The COBOL-text is assumed to be one or more COBOL sentences. Within this text Jazz will look for, and substitute, references to fields and groups defined within the rest of the program: -

†††† COBOL;
†††††††† SEARCH WORK.TABLE
†††††††† †† AT END
†††††††† †††††††† MOVE ZEROES TO OUTFL.SALES-TAX
†††††††† †† WHENINPTFL.STATE = WORK.TABLE-STATE (WORK.INDX)
†††††††† †††††††† MOVE WORK.TABLE-TAX TO OUTFL.SALES-TAX
†††††††† END-SEARCH;
†††† END COBOL;

 

Jazz recognises that references like WORK.TABLE are Jazz references simply because there is no valid COBOL syntax of

††††††††††† Word Period Word

without intervening spaces. Jazz will therefore look up WORK.TABLE and, if it finds it, it will replace this with the equivalent COBOL-form reference, perhaps JZ-TABLE OF WORK.You can use COBOL reserved words as Jazz item names, and because you refer to them in the COBOL text with a Jazz-format reference there is no problem in referring to them in the COBOL text.

 

The end of the COBOL text is indicated by a semicolon. This is necessary to tell Jazz that this is the end of the text, and to expect END COBOL. If omitted the rest of your program will be treated as COBOL text to be inserted. The semicolon does NOT become a period in the inserted text.

 

Apart from this Jazz performs almost no analysis or checking of this text to ensure that it is valid COBOL, or that makes sense and is valid within the context that it is placed. This makes it very easy to make errors:

 

1.        There is no check that the COBOL-text consists of one or more complete COBOL sentences.Errors are not detected by Jazz, but left to the following COBOL compile step.

2.        You might refer directly to Jazz-generated COBOL variables (not using a reference like WORK.TABLE). If you do, be especially careful that you donít interfere with Jazz logic, and be aware that any such references are not included in the Jazz data dictionary database.

3.        You have to be especially careful if you include periods in your text.The code might be inserted within nested logic and you might not only be terminating your IF statement, but also a stack of nested IF statements that Jazz has generated that you didnít realise were there.