1. Home
  2. Knowledge Base
  3. Implementers
  4. Known Application Issues
  5. Issue: Custom Statement Commented Lines Should Be Completely Ignored

Issue: Custom Statement Commented Lines Should Be Completely Ignored

COBOL Process error message returned because Operand Alias on a commented line was not resolved.

Issue

Custom Statement configuration includes the option to comment out a line using the Keyword //. The commented line should be completely ignored when the Custom Statement is resolved.

The Custom Statement module (PAPUCSTM) does in fact skip resolving the Alias:

      ******************************************************************
      *                                                                *
       JA100-EVAL-EXPRESSION SECTION.
       JA100.
      *                                                                *
      *    EVALUATE EACH EXPRESSION. IGNORE COMMENTS.                  *
      ******************************************************************

           IF NOT COMMENT OF CUSTM-ARRAY(CUSTM-IDX)


      *    RETRIEVE VALUES FOR ALIAS OPERANDS

               PERFORM RA000-RTRV-ALS-OPERAND1
               PERFORM RG000-RTRV-ALS-OPERAND2
COBOL – PAPUCSTM.cbl

However later in the program, when evaluating the IF statement, the “Value for alias field is not returned” error message is returned by the COBOL Process

ERROR IN PGM:(16005,28008) PI(221) Program(PAPUGRDF)
Value for alias field is not returned- 
Calc:MWT_TRS12301031706 Empl:029398 Plan:TRS FR:T_BF900_F
CALC-NAMEMWT_TRS12301031706 IS ENDING WITH ERRORS
COBOL Error Message

This message text does not report the name of the Alias that was not returned, but a message parameter with the name is recorded:

Use Case

While setting up a new plan, I copied an existing Group Definition custom statement from a previously implement plan. Not all aliases identified as operands had been set up at this point, so I chose to comment out the line from the custom statement, leaving it as a placeholder for subsequent updates that would need to be made. I expected the commented line would be completely ignored when the Group Definition was resolved.

Replicate

The following steps can be used to replicate the issue.

Set up a Custom Statement, in this case, a Group Definition, that includes a comment line with an Alias that would not have been resolved yet.

When the process runs, the “Value for alias field is not returned” error message is returned. We can see from the message parameters that the alias not returned is from the commented-out line, M_BEDS_F.

Workaround

A simple workaround for this problem is to not use the // comment keyword in a Custom Statement.

Solution

A COBOL programming solution that more carefully tests the Keyword value to identify comments and ignore the line could be implemented. The program refers to custom statement lines before or after the line currently being processed when evaluating logic that extends across multiple lines, such as IF-THEN-ELSE. These references would need to take into account that the other line could be a commented line.

A much easier solution is to exclude comment lines from the Custom Statement configuration that gets loaded into the COBOL program. There is no reason a commented row needs to be included in the configuration data retrieved by the program.

The following updates can be made to the stored statement PAPUCSTM_S_PACUSTM in PAPUCSTM.dms to add a new Keyword <> ‘//’ condition to exclude commented lines from processing:

STORE PAPUCSTM_S_PACUSTM
SELECT A.CUSTOM_STMT_NAME,
  A.PA_SEQ_NUM,
  A.STMT_TYPE,
  A.KEYWORD,
  A.OPERAND1,
  A.OPERAND2,
  A.OPERAND3,
  A.OPERAND1_HIST,
  A.OPERAND2_HIST,
  A.OPERAND3_HIST,
  A.OPERAND1_DT,
  A.OPERAND2_DT,
  A.OPERAND3_DT,
  A.OPERATOR1,
  A.OPERATOR2,
  A.OPERAND1_TYP,
  A.OPERAND2_TYP,
  A.OPERAND3_TYP,
  A.OPERAND1_CHAR,
  A.OPERAND2_CHAR,
  A.OPERAND3_CHAR,
  A.OPERAND1_DEC,
  A.OPERAND2_DEC,
  A.OPERAND3_DEC,
  A.OPERAND1_DATE,
  A.OPERAND2_DATE,
  A.OPERAND3_DATE,
  A.OPERAND1_SEQ,
  A.OPERAND2_SEQ,
  A.OPERAND3_SEQ,
  A.OPERAND1_ALSTYP,
  A.OPERAND2_ALSTYP,
  A.OPERAND3_ALSTYP,
  A.OPERAND1_PLAN,
  A.OPERAND2_PLAN,
  A.OPERAND1_PIC,
  A.OPERAND2_PIC,
  A.OPERAND3_PIC,
  B.CUSTOM_TYPE,
  B.CUSTOM_ORDER
  FROM PS_PA_CUSTOM2 A,
       PS_PA_CUSTOM  B
  WHERE A.CUSTOM_STMT_NAME= :1  AND
        A.CUSTOM_STMT_NAME = B.CUSTOM_STMT_NAME
        /* DT-00251 01/27/2023 - Begin */
        AND A.KEYWORD <> '//'
        /* DT-00251 01/27/2023 - End */
  ORDER BY A.PA_SEQ_NUM
;
COBOL Stored Statement – PAPUCSTM.dms

Resolution

After the proposed fix is installed, the commented-out rows are completely ignored by the custom statement processor.

Analysis

This issue has not been reported to Oracle.

Was this article helpful?

Related Articles

Leave a Reply