I have to reset the identity column value for the field automatically generated by an identity in all the files in my library. I have to write an RPG program to get all such files with an identity column field and then reset their identity value using the ALTER TABLE statement.
How can I identify what files in my library have an identity column present?
If you want to get the list of all the files in a library with a field whose value is automatically generated by an identity, i.e., an identity column defined, then you can use the following SQL query.
select table_schema, table_name, column_name, data_type, length,
numeric_scale, identity_generation
from syscolumns
where table_schema = 'LibName' and is_identity = 'YES'
You can then create a cursor out of this query in your SQLRPGLE program and perform your further tasks.