Previous Topic Next topic Print topic


Mainframe Pre-compiler Support

Note: The Mainframe Pre-compiler Support is available for COBOL only.

It can only be used in conjunction with an AWM modeled remote edit action (see the tool Edit/Browse MVS File of the AWM function package). There is no support for COBOL programs opened from MVS Explorer in the Mainframe Systems Explorer view.

The Mainframe Pre-compiler Support is a technique that lets you call language pre-compilers (aka pre-compilers) on the mainframe while editing a source file on the client machine. The source file will be taken from the editor and precompiled on the mainframe. The result will be transferred back to the client machine and used as input to the background parsing process, so the editor will not flag syntax errors due to an unknown pre-compiler. All COBOL variables are usable with the Content Assist.

To use the Mainframe Pre-compiler Support, additional configuration is necessary.

Configuring Mainframe Pre-compiler Support on the mainframe

A Mainframe Pre-compiler must be configured on the mainframe site to be used with the Mainframe Pre-compiler Support. A pre-compiler specific REXX procedure must be written on the mainframe to connect a pre-compiler. That procedure has to set up the required environment for the pre-compiler e.g. by allocating data sets and then call the pre-compiler.

Mainframe Pre-compiler Interface Procedure TAUCZXPP

The pre-compiler interface procedure has to be named TAUCZXPP and must be placed on a library that is in the search path in the user server. TAUCZXPP is called with the following parameters:

Parameter Description
Indsn Data set name of a cataloged mainframe file containing the input source for the pre-compiler. This is the content of the editor on the client machine when the background parse process started.
Outdsn Data set name of a cataloged mainframe file for the output generated by the pre-compiler. This is the translation of the input file as done by the pre-compiler and should be valid COBOL.
Msgdsn Data set name of a cataloged mainframe file for messages generated by the pre-compiler
Chgdsn Data set name of a cataloged mainframe file for information about changes done by the pre-compiler
Parms Additional user supplied parameters for the pre-compiler call

All data sets exist in the mainframe file system when the procedure is called. The procedure must allocate the input and output data sets to the pre-compiler specific DD names. The message and change data sets are optional and need to have a special format as described in the following sections.

The following return codes of TAUCZXPP are supported:

Return code Description
0 Changes done by the pre-compiler are known and the change data set is filled.
1 Changes done by the pre-compiler are unknown and TAUCZXPP did not fill the change data set.

If return code 1 is received, the mainframe pre-compiler interface will try to set up a change data set by comparing the input data with the output data. A simple TAUCZXPP might just generate the output data set and issue return code 1.

Message data set format

Messages from a pre-compiler must be placed in the message data set. The data set is a fixed block data set with a logical record length of 80. It is already cataloged when TAUCZXPP is called.

There must be one line for each message:

Offset Length Description
0 5 Number of the line in the input source that this message belongs to (right padded filled with 0)
5 1 Message level:

I=informational

W=warning

E=error

S=severe error

6 74 Message text

Changes data set format

The local compiler needs to know which lines of the original source code were changed, inserted or deleted by the mainframe pre-compiler. This information may be calculated using the Mainframe Pre-compiler Interface by issuing return code 1 from TAUCZXPP, or may be set by TAUCZXPP itself. The data set is a fixed block data set with a logical record length of 80. It is already cataloged when TAUCZXPP is called.

Changes can be grouped into blocks so that, for example, deleting five consecutive lines is a block of five lines.

There must be one line for each change block:

Offset Length Description
0 5 Number of the line in the input source that this change belongs to (right padded filled with 0)
5 1 Reserved (should be blank)
6 1 Type of change

I=inserted lines

D=deleted lines

C=changed (reformatted) lines

7 1 Reserved (should be blank)
8 5 Length of the change block (right padded filled with 0)
13 67 Reserved (should be blank)

Sample Mainframe Pre-compiler Interface

The following is a sample for a TAUCZXPP:

 /*REXX****************************************************************** 
 * AWM Mainframe Pre-compiler Exit 
 ***********************************************************************/ 
 
 Parse Arg indsn outdsn msgdsn chgdsn parms /* (1) */ 

 "ALLOC F(INDD) DA('" indsn"') SHR REUSE“   /* (2) */ 
 "ALLOC F(OUTDD) DA('"outdsn"') SHR REUSE" 
                                            /* (3) */ 
 "EXECIO * DISKR INDD(FINIS STEM in." 
 
 ocnt = 0 
 mcnt = 0 
 Do i = 1 To in.0 
   ocnt = ocnt + 1 
   o.ocnt = in.i 
   If Substr(Left(in.i, 7), 7) = '*' Then 
     Iterate 
   p = Pos('picx', in.i) 
   if (p > 0) Then Do 
     o.ocnt = Strip(Left(o.ocnt, p-1)'pic x'Substr(o.ocnt, p+4), "T") 
     End 
   p = Pos('2xmv', in.i) 
   if (p > 0) Then Do 
     line = Strip(Left(o.ocnt, p-1)'move'Substr(o.ocnt, p+4), "T") 
     o.ocnt = line 
     ocnt = ocnt + 1; o.ocnt = line 
     mcnt = mcnt + 1; m.mcnt = Right(i, 5, '0')'W' !! 'Line duplicated' 
     End 
   p = Pos('d-mv', in.i) 
   if (p > 0) Then Do 
     ocnt = ocnt - 1 
     End 
   End 
 
 "EXECIO "ocnt" DISKW OUTDD(OPEN FINIS STEM o. " 
 
 "FREE F(OUTDD)"                                  /* (4) */ 
 "FREE F(INDD)" 
 
 "ALLOC F(MSGDD) DA("' msgdsn"' SHR REUSE"        /* (5) */ 
 "EXECIO "mcnt" DISKW MSGDD(OPEN FINIS STEM m." 
 "FREE F(MSGDD)” 
 
 EXIT 1                                           /* (6) */ 

It contains the following steps:

  1. Accept all input parameters as REXX arguments.
  2. Set up the environment for the pre-compiler.
  3. Execute the pre-compiler.

    The pre-compiler in this sample is internal to the REXX but it could also be a called external application.

  4. Clean up the environment.
  5. (Optionally) create a message file.
  6. Issue return code 1 to let the interface calculate the changes done by the preprocessor.

Configuring Mainframe Pre-compiler Integration on the client machine

COBOL compiler options can be set in an AWM model by the AWM application specific attribute COMPOPT.

In order to integrate a Mainframe pre-compiler, the COMPOPT attribute must contain the call of the local pre-compiler interface:

p(AWMREMPC)  ENDP

After p(AWMREMPC) all parameters can be passed which are needed by the Mainframe pre-compiler.

Another AWM application-specific attribute AUTO_PARSE controls whether the background parse process of the editor is started automatically or only if explicitly called.

We recommend you set AUTO_PARSE to FALSE if a Mainframe pre-compiler is configured. In this case, you should model a tool of type “Reparse with Refresh” from the Micro Focus Editor function package, and add it as a related action to the element type representing COBOL programs and as global editor action. This action can be used to trigger the start of the pre-compiler interface from the context menu of the COBOL program and the editor context menu.

Previous Topic Next topic Print topic