IDMS: How to retrieve the ROWID after an INSERT
search cancel

IDMS: How to retrieve the ROWID after an INSERT

book

Article ID: 196904

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

This document describes how to retrieve the ROWID of the most recently INSERTed row in an IDMS/SQL program.

This would be analogous to addressing the DBKEY field or using the ACCEPT DB-KEY verb against a network-defined database.

Environment

Release : 19.0
Component : CA IDMS/SQL

Resolution

The GET DIAGNOSTICS statement can be used in a program to retrieve the ROWID of the most recently INSERTed row.

The attachment below is the source code of a batch program which shows how this can be done. 
It performs an INSERT, retrieves the ROWID, and then issues a SELECT against the same table based on the retrieved ROWID.

This example requires the use of Virtual Foreign Key support. 

Attachments

1597133523817__sampgrfi.zip get_app