Page 1 of 1

Is it possible to declare condition variable inside an array

PostPosted: Fri Sep 23, 2016 4:32 pm
by hariharan_bk
Hi All,

I have a scenario where i need to compare fields from an array against a table. While looping the array fields to compare every occurence with respective table field, i need to set MATCH/MISMATCH IND to TRUE.

My question is -
In order to set the match/mismatch statuses for every occurences, i thought of using a 88 level variable to serve the purpose. But not sure if we can have condition variables to the fields in an array.

Please confirm if this is possible? If possible, please let me know how we set these fields?



01 WS-TABLE.
   05 WS-PHONE-MATCH-IND OCCURS 100 TIMES.
      10 WS-VAR1-MAT PIC A(1).
           88   Match1        Value 'Y'.
           88   Mis-Match1    Value 'N'.
      10 WS-VAR2 PIC A(1).
           88   Match2        Value 'Y'.
           88   Mis-Match2    Value 'N'.
 


can we set this way?

SET MATCH1 (i) TO TRUE
 


Please advise. I dont have an environment ready to test this in my end. Currently working on Pseudo code for design documents. Please help here.

Re: Is it possible to declare condition variable inside an a

PostPosted: Fri Sep 23, 2016 6:45 pm
by Robert Sample
I tested with Enterprise COBOL 5.1.1 and you can use 88 levels under an array. You use a subscript or index on the 88 level just like any other variable:
IF  MATCH1 (WS-SUB)
    <DO WHATEVER>
END-IF
You can use the SET TO TRUE or a MOVE to the array element -- whichever you want to do.

Re: Is it possible to declare condition variable inside an a

PostPosted: Fri Sep 23, 2016 8:48 pm
by hariharan_bk
Many thanks, Robert.

Got a relief to design now, to have a Condition variable for each occurrence of an array element.