I have a CHAIN operation as defined below:
chain(e) (GetIacIsrKey.BaseKeyNumber:
wNameKeyNumber:
GetIacIsrKey.SocietyCode) IACISR001R IacIsrData;
The file is declared as below:
FIACISR001 IF E K DISK rename(IACISR:IACISR001R) usropn
I know it retrieves the first found record.. If I were to convert this to SQL, how would I write it considering I want to fetch the same record fetched by chain?
SELECT * FROM IACISR WHERE
BASEKEY = <VALUE> AND
NAMEKEYNUMBER = <VALUE> AND
SOCIETYCODE = <VALUE> FETCH FIRST ONLY ..
I am concerned if the ordering would change bw chain and select ?
In summary, my question should be what is the default order in which chain retrieves a record. This is a table created using SQL and has PRIMARY KEY( BASEKEY , NAMEKEY , SOCCODE , LOCAFFNO ) ) defined.
I am not expert in SQL so I don't know what the default order is. But you could add "ORDER BY LOCAFFNO" to get it to return the record with the earliest LOCAFFNO value.