FD ACC.
01 ACC-REC.
05 ACC-KEY.
10 ACC-ID PIC 9(6).
10 ACC-TY PIC 9(3).
10 ACC-CU PIC 9(3).
10 ACC-BR PIC 9(3).
10 ACC-IN-CD PIC 9(2).
If you look at the generated code you will see the following WHERE clauses:
where (ACC_ID = ? and ACC_TY = ? and ACC_CU = ? and ACC_BR = ? and ACC_IN_CD >= ?)
where (ACC_ID = ? and ACC_TY = ? and ACC_CU = ? and ACC_BR > ?)
where (ACC_ID = ? and ACC_TY = ? and ACC_CU > ?)
where (ACC_ID = ? and ACC_TY > ?)
where (ACC_ID > ?)
so that if ACC-KEY is 00000100200300405 then the code for START ACC KEY NOT < ACC-KEY followed by a READ NEXT loop first uses:
where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU = 3 and ACC_BR = 4 and ACC_IN_CD >= 5) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD
and after returning all of the rows in that result set (or if the result set it empty), then the code uses
where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU = 3 and ACC_BR > 4) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD
and after returning all of the rows in that result set (or if the result set it empty), then the code uses
where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU > 3) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD
and after returning all of the rows in that result set (or if the result set it empty), then the code uses
where (ACC_ID = 1 and ACC_TY > 2) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD
and after returning all of the rows in that result set (or if the result set it empty), then the code uses
where (ACC_ID > 1) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD