Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

renaming ET/UV tables with system date/time

Status
Not open for further replies.

irishdragon

Programmer
May 20, 2004
9
US
If the ET error table or the UV duplicate tables are created, I want to rename them with the system date and time. The variables &sysdate includes slashes ('/'), and the variable &systime includes colons (':'). I want to rename these tables without the / and :. Currently, we use the day of week and the number of records in the table, like THU20, for example. Not very descriptive or useful.

Is there a way to eliminate the / and : and rename tables using the date and time?

Here's our current code:

.IF &SYSRC > 0 THEN;
.LOGOFF &SYSRC;
.ENDIF;
.SET RETURNCD TO &SYSRC;

.IF &SYSETCNT > 0 THEN;
.SET RETURNCD TO 01;

RENAME TABLE SERVICE_ASSURANCE.ET_TATD810_STG_LSR_FOC
TO SERVICE_ASSURANCE.ET_TATD810_STG_LSR_FOC_&SYSDAY&SYSETCNT;
.IF &SYSRC <> 0;
.DISPLAY 'ET RENAME UNSUCCESSFUL' TO FILE SYSPRINT;
.LOGOFF &SYSRC;
.ENDIF;
.ENDIF;
.IF &SYSUVCNT > 0 THEN;
.SET RETURNCD TO 02;

RENAME TABLE SERVICE_ASSURANCE.UV_TATD810_STG_LSR_FOC
TO SERVICE_ASSURANCE.UV_TATD810_STG_LSR_FOC_&SYSDAY&SYSUVCNT;
.IF &SYSRC <> 0;
.DISPLAY 'UV RENAME UNSUCCESSFUL' TO FILE SYSPRINT;
.LOGOFF &SYSRC;
.ENDIF;
.ENDIF;
.IF &SYSETCNT > 0 AND &SYSUVCNT > 0 THEN;
.SET RETURNCD TO 03;
.ENDIF;
 
Here is an approach I am trying with no luck. I guess SUBSTR cannot be used with a .SET command?
########################################
.SET TODAY_STAMP TO SUBSTR(&SYSDATE4,1,4) ||
SUBSTR(&SYSDATE4,6,2) ||
SUBSTR(&SYSDATE4,9,2) ||
SUBSTR(&SYSTIME,1,2) ||
SUBSTR(&SYSTIME,4,2) ||
SUBSTR(&SYSTIME,7,2)
RENAME TABLE SERVICE_ASSURANCE.ET_TATD810_STG_LSR_FOC
TO SERVICE_ASSURANCE.ET_TATD810_STG_LSR_FOC_&TODAY_STAMP;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top