Page 1 of 1

SEARCH ALL

PostPosted: Fri Dec 21, 2012 11:26 am
by hvats83
In program there is a table defined below-

01  MMF-ACCOUNT-TABLE.
           05  MMF-INFO
               OCCURS 500000 TIMES
               ASCENDING KEY IS MMF-RK-ACCT-ID
               INDEXED BY MMF-INDEX MMF2-INDEX.
               10  MMF-RK-ACCT-ID        PIC 9(08).
               10  MMF-EOD-ST-AM         PIC S9(13)V9(2).

In program I am using search all on this table.If I use MMF2-INDEX in SEACH ALL operation, program is abending and on using index MMF-INDEX program runs successfully.

Please suggest me why this is happening.

Re: SEARCH ALL

PostPosted: Fri Dec 21, 2012 12:08 pm
by BillyBoyo
Can you provide details of the abend, please?

Re: SEARCH ALL

PostPosted: Fri Dec 21, 2012 12:41 pm
by hvats83
Following error occurred-

IGYPS2117-E Subscripted item "MMF-RK-ACCT-ID" in "SEARCH ALL" statement was not indexed by the first index for that table. The first index was assumed.

Re: SEARCH ALL

PostPosted: Fri Dec 21, 2012 1:12 pm
by BillyBoyo
Well, that is not an abend, it is a compile error. If you re-read the message, it'll be clear that the SEARCH ALL is expected to use the first index for the table only. Why would you want to use a different index anyway?

Re: SEARCH ALL

PostPosted: Fri Dec 21, 2012 1:30 pm
by hvats83
Yes it is compile error and I wrongly mentioned it as abend.
I was not aware that we have to use first index in SEARCH ALL.
Thanks a lot for the reply.

Re: SEARCH ALL

PostPosted: Fri Dec 21, 2012 1:44 pm
by BillyBoyo
Well, it is there in the Language Reference:

The index used is always that associated with the first index-name specified in the OCCURS clause.