« Process All Database Record Types | Main | Creating tabfiles, tables and indexes in DBMS »
Tuesday
Jul292008

Adding a row to a tabfile table

The following code adds a row to an existing tabfile table:

CONNECT TABFILE updates FILENAME 'UPDATES.TBF' WRITE
PROGRAM
c
c program to access update details tabfile and addrow for the update being undertaken.
c
c write cohort, current database update level, date, time, user and update comment
STRING*140 COMMENT
COMPUTE UPDLEVELNOW=UPDLEVEL(0)
NEW ROW IS UPDATES.TABLE1 TUPDATE INDEXED BY UPDLEVDESC(UPDLEVELNOW)
. COMPUTE UPDDATE=TODAY(0)
. COMPUTE UPDID=SIRUSER('')
. COMPUTE COMMENT="Details of the data to be saved on the tabfile"
. PUT VARS UPDDATE UPDID COMMENT
END ROW IS
IFTHEN(SYSTEM(28) <>1)
. WRITE '*** ERROR IN WRITING TO UPDATES TABFILE - ROW NOT WRITTEN ***'
ENDIF
END PROGRAM
DISCONNECT TABFILE updates

We use a version of this program as a member, calling it everytime we do an update, providing us with a handy log of all our updates and schema modifications.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>