IBM Support

How ILE COBOL Program Handles Omitted Parameter

Troubleshooting


Problem

This document explains how an ILE COBOL program handles an omitted parameter.

Diagnosing The Problem

Resolving The Problem

When using a CALL By REFERENCE or a CALL By CONTENT and there is a LINKAGE TYPE of procedure, you can use the reserved word 'OMITTED'.  This will pass a NULL pointer to the called program. When OMITTED is used, the called program will use the parameter's default value. In the called program, you can use the CEETSTA API to determine if a specified parameter is OMITTED. ILE CEE APIs have parameters that can be omitted. The parameter table for each ILE CEE API uses the term omissible for these parameters.
https://www.ibm.com/docs/en/i/7.6.0?topic=category-ile-cee-apis
 
Warning: It is essential to pass the correct number of parameters, including omitted parameters. You need to use the language-specific syntax for omitted parameters; failure to do so may result in unpredictable results, including a system failure.

For ILE COBOL, you can omit a parameter by specifying the reserved word OMITTED in place of the parameter. The following example in ILE COBOL omits the FC parameter in the call to the API:

Example

CALL PROCEDURE 'CEExxxx'
USING PARM1, PARM2, ... PARMn, OMITTED.


Failure to pass an omissible parameter can lead to unexpected results. In one case, we found that an MCH1867 error sent because the correct number of parameters on a CALL to a CEE API was incorrect. The CEETSTA API is used to determine which parameter is omitted. Once we added the omitted parameter on the CALL to the API (see line 324 in the example below), the MCH1867 no longer occurred:

Example
​
0320.00        Check-parameter.                                    
0321.00            call CEETSTA                                    
0322.00                    using   Presence-flag                  
0323.00                            Argument-number                
0324.00 IBM                        Omitted                        <=== include this parameter
0325.00            end-call                                        
0326.00        .                        
See:
https://www.ibm.com/docs/en/i/7.6.0?topic=ssw_ibm_i_76/apis/ile1a5.html
         

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000F98bAAC","label":"Programming ILE Languages-\u003ECOBOL"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

514440528

Document Information

Modified date:
16 April 2025

UID

nas8N1013200