×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Get-Current-DateTime bug?

Get-Current-DateTime bug?

Get-Current-DateTime bug?

(OP)
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

RE: Get-Current-DateTime bug?

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.

RE: Get-Current-DateTime bug?

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.

RE: Get-Current-DateTime bug?

"You can also do a select in PSLOCK"

Don't you mean PSCLOCK?

RE: Get-Current-DateTime bug?

(OP)
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

RE: Get-Current-DateTime bug?

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.

RE: Get-Current-DateTime bug?

(OP)
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

RE: Get-Current-DateTime bug?

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close