1. Home
  2. Knowledge Base
  3. Implementers
  4. Known Application Issues
  5. Issue: Custom Statement Assignment from Character or Date Temporary Variable Fails

Issue: Custom Statement Assignment from Character or Date Temporary Variable Fails

COBOL Process error message returned due to a Custom Statement configuration issue. The Custom Statement result type is not set correctly when the result is assigned from a Character or Date temporary variable.

Issue

When a Custom Statement is intended to be assigned a Character or Date, but the assignment is from a temp variable, the fields PA_CUSTOM2@.OPERAND3_PIC and PA_ALIAS_USE.ALIAS_FLD_PIC might not get assigned correctly when the Custom Statement is saved and resulting in an “Error in assignment – incompatible types” error message in the COBOL processes.

Use Case

Configuration for Early and Normal Retirement Dates requires some complicated configuration logic to use completed service or projected service to find the earliest dates that the member qualifies. With more than one way to qualify, the Min and Max functions are required. The IF-THEN-ELSE can not directly assign the result of the MIN/MAX functions, so a temporary variable needs to be used.

Replicate

The following steps can be used to replicate the issue.

Set up a Custom Statement Alias that assigns results from a temporary variable holding a date value:

TEMPD01, TEMPD02, and TEMPD03 are being assigned Date values. Support for Dates in the Min/Max functions is provided by another customization.

When the Custom Statement page is saved, the OPERAND3_PIC field should be set to DATE, but it is set to DEC(09,06):

Similarly, the ALIAS_FLD_PIC on PA_ALIAS_USE should be DATE, but it is set to DEC(09,06):

The incorrect PA_CUSTOM2.OPERAND3_PIC value causes this “Error in assignment – incompatible types” error message:

ERROR IN PGM:(16005,27106) PI(443) Program(PAPUCSTM)
Error in assignment - incompatible types T_ERD_CS. 
MWT_TRS12301031706 029398 TRS T_EAHEA_F.
COBOL Error Message

If only OPERAND3_PIC is updated using SQL, an incorrect PA_ALIAS_USE.ALIAS_FLD_PIC value causes this “Alias balue field type does not match alias type” error message:

ERROR IN PGM:(16005,28042) PI(445) Program(PAPUALCS)
ALIAS T_ERD_CS VALUE FIELD TYPE DOES NOT MATCH ALIAS TYPE .- 
Calc:MWT_TRS12301031706 Empl:029398 Plan:TRS FR:T_EAHEA_F
COBOL Error Message

Workaround

A workaround that tricks the Custom Statement page into setting the type correctly could not be identified.

Solution

Instituting a naming convention where temporary variables for decimal values will use TEMPxx, character values will use TEMPCxx, and dates values will use TEMPDxx, the following code will fix the issue, otherwise, a different solution is required to resolve what type of value is being assigned to the temp alias and setting the PA_CUSTOM2.OPERAND3_PIC and PA_ALIAS_USE.ALIAS_FLD_PIC values to match.

The following updates can be made to PA_CUSTOM2.OPERAND1.SaveEdit PeopleCode:

. . .
  If &TYPE1 = "A" Then
     If Find("CHAR", &FLD_PIC1) > 0 Or
           Find("TIME", &FLD_PIC1) > 0 Then
        &TYPE1 = "C";
     Else
        If Find("DATE", &FLD_PIC1) > 0 Then
           &TYPE1 = "D";
        Else
           /* DT-00252 12/12/2022 MWT - Begin */
           If Find("TEMPD", PA_CUSTOM2.OPERAND1) > 0 Then
              &TYPE1 = "D";
           Else
              If Find("TEMPC", PA_CUSTOM2.OPERAND1) > 0 Then
                 &TYPE1 = "C";
              Else
                 /* DT-00252 12/12/2022 MWT - End */
                 &TYPE1 = "N";
                 /* DT-00252 12/12/2022 MWT - Begin */
              End-If;
           End-If;
           /* DT-00252 12/12/2022 MWT - End */
        End-If;
     End-If;
  End-If;
  If &TYPE2 = "A" Then
     If Find("CHAR", &FLD_PIC2) > 0 Or
           Find("TIME", &FLD_PIC2) > 0 Then
        &TYPE2 = "C";
     Else
        If Find("DATE", &FLD_PIC2) > 0 Then
           &TYPE2 = "D";
        Else
           /* DT-00252 12/12/2022 MWT - Begin */
           If Find("TEMPD", PA_CUSTOM2.OPERAND2) > 0 Then
              &TYPE2 = "D";
           Else
              If Find("TEMPC", PA_CUSTOM2.OPERAND2) > 0 Then
                 &TYPE2 = "C";
              Else
                 /* DT-00252 12/12/2022 MWT - End */
                 &TYPE2 = "N";
                 /* DT-00252 12/12/2022 MWT - Begin */
              End-If;
           End-If;
           /* DT-00252 12/12/2022 MWT - End */
        End-If;
     End-If;
  End-If;
  If &TYPE3 = "A" And
        PA_CUSTOM2.CUSTOM_STMT_NAME <> PA_CUSTOM2.OPERAND3 Then
     If Find("CHAR", &FLD_PIC3) > 0 Or
           Find("TIME", &FLD_PIC3) > 0 Then
        &TYPE3 = "C";
     Else
        If Find("DATE", &FLD_PIC3) > 0 Then
           &TYPE3 = "D";
        Else
           /* DT-00252 12/12/2022 MWT - Begin */
           If Find("TEMPD", PA_CUSTOM2.OPERAND3) > 0 Then
              &TYPE3 = "D";
           Else
              If Find("TEMPC", PA_CUSTOM2.OPERAND3) > 0 Then
                 &TYPE3 = "C";
              Else
                 /* DT-00252 12/12/2022 MWT - End */
                 &TYPE3 = "N";
                 /* DT-00252 12/12/2022 MWT - Begin */
              End-If;
           End-If;
           /* DT-00252 12/12/2022 MWT - End */
        End-If;
     End-If;
  End-If;
. . .  
PeopleCode – PA_CUSTOM2.OPERAND1.SaveEdit

Resolution

After the proposed fix is installed, and the custom statements modified/saved, the problem fields are set correctly, and the process run without failure:

Analysis

This issue has not been reported to Oracle.

Was this article helpful?

Related Articles

Leave a Reply