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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get-Current-DateTime bug?

Status
Not open for further replies.

lcisa

Programmer
May 16, 2005
7
US
I'm working on a custom SQR program which calls the procedure Do Get-Current-DateTime back-to-back. The results are unexpected. The $sysdatetime variable stays the same. Why? I even did a call system sleep for 60 seconds between the procedure and the $sysdatetime is still the same. I'd expect that the seconds would change. I need the $sysdatetime variable to be different because I use it to populate a key field. Has anyone had this same problem? Resolution?

PT 8.19.12
HRMS 8.3
SQL Server 2000
 
Post the portion of SQR that deals with the get-current-date
function. I assume that you get-current-date is somewhere in of those SQCs.
 
Pardon me but it has been a long time. If you want your $SysDateTime to have a moving variable, then always call the sqc ...ie.. DO get-current-datetime. You also display the
variable like:

do get-current-datetime
display $Sysdatetime

Repeat the routine as many as you want. If there is no changing of the times then your database is down or is not
working properly since pslock which carry the system timestamp
is located in the database. You can also do a select in PSLOCK
and check timestamp.
 
This procedure(below) is called back-to-back and is not a custom SQR. It's canned from PS. Notice the do get-current-datetime call and the population of $rundatetime. I did some shows and it is running get-current-datetime both times, but for some reason(bug?) the $rundatetime value from the second is the same as from the first.
There's something else, this might help diagnose. When I run the datenow() function in a SQR using the {native-datetimemask} back-to-back waiting a span of seconds it returns the same value. This is not right. I appreciate your expertise. Thank you.

! Refresh the current Date/Time
Do Get-Current-DateTime
Move $_AsOfToday to $RunDate
Move $_SysDateTime to $RunDateTime
Move $_username to $Oprid

Let $PlanTypeHist = Rtrim($PlanType,' ')
If $PlanTypeHist = ''
Let $PlanTypeHist = ' '
End-If

BEGIN-SQL
INSERT INTO PS_BN_SNAP_HIST
(ASOFDATE
,RUNDATE
,RUNDTTM
,BN_SNAP_HIST_TYPE
,SETID
,VENDOR_ID
,PLAN_TYPE
,OPRID
,FILENAME
,RECORD_COUNT
,SCHED_ID)
VALUES
($AsOfDate
,$RunDate
,{DateTimeIn-Prefix}$RunDateTime{DateTimeIn-Suffix}
,$BNSnapHistType
,$SetId
,$VendorId
,$PlanTypeHist
,$Oprid
,$FileName
,#WriteCount
,' ')
END-SQL

SQL Server 2000
PT 8.19.12
 
I don't have SQL 2000 with me but does your CURDTTIM.sqc uses
$_SysDateTime or $SysDateTime? Is CURDTTIM.sqc included in the SQR? Check your sqc and make sure it is using the correct variable. Also check your pssqr.ini and make sure the datetime variables are correctly setup for SQL 2000.
 
1) Yes CURDTTIM.sqc is included. The right variable is being used. Below from CURDTTIM.sqc

#ifdef MICROSOFT
begin-SELECT
{DateTimeOut-Prefix}GETDATE(){DateTimeOut-Suffix} &_SysDateTime
FROM PSCLOCK
end-SELECT
let $tempDate = &_SysDateTime
----------------
! Format the Global Variables
let $_SysDateTime = datetostr($tempDate,{Native-DateTimeMask})
let $_AsOfToday = datetostr($tempDate,{Native-DateMask})
let $_AsOfNow = datetostr($tempDate,{Native-TimeMask})
let $_CurrentCentury = datetostr($tempDate,'CC')

! Set ReportDate/Time
let $_ReportDate = datetostr($tempDate,{PTRPTDATE})
let $_ReportTime = datetostr($tempDate,{PTRPTTIME})

#ifdef debugx
show 'Exiting CURDTTIM.SQC: Get-Current-DateTime'
show ' Output $AsOfToday : ' $_AsOfToday
show ' Output $AsOfNow : ' $_AsOfNow
show ' Output $ReportDate : ' $_ReportDate
show ' Output $ReportTime : ' $_ReportTime
show ' Output $SysDateTime: ' $_SysDateTime
#endif

2) The datetime variables are setup correctly.

SETENV.SQC

#ifdef MICROSOFT
#define PT-DBType 'MICROSFT' !No, this is not a typo
#define Native-DateTime YYYY-MM-DD_HH:MI:SS
#define Native-DateTimeMask 'YYYY-MM-DD HH:MI:SS.NNN'
#define Native-DateMask 'YYYY-MM-DD'
#define Native-TimeMask 'HH:MI:SS.NNN'
#define Native-Time24Mask 'HH:MI:SS'

PSSQR.INI

[Environment:ODBC]
; MicroSoft Format
SQR_DB_DATE_FORMAT=YYYY-MM-DD HH:MI:SS.NNN
FixODBCAccuracy = TRUE
;ENCODING-DATABASE=UCS-2
;ENCODING-CONSOLE=CP932

Not sure where to look next.

Thanks,
Greg
 
What did Peoplesoft said about your problem? It looks like the apps is not properly communicating with your OS. It looks more like installation setting problem like some clock options in the database. This can also true if ODBC is not properly setup. I will take a look closely with configurations using your configuration manager.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top