|
Retrieving the date & time from the server.
When running client-server software, most often the client machine time is different than that of the server. This is particularly apparent if users are spread across different time zones and can even result in different dates. It is often necessary for the client side processing to be dependant on the time that the server reflects and not the time that the client is at.
The VL Accelerator provides a Server-Side Function that returns the Server Data and Time as well other Server information to the Calling function. The Server-side Function is FWBI01 - Server Information Interface and is listed below for your reference and use.
When using
the VL Accelerator, this information can be easily retrieved using the
Client and Server Job Information Interface. However, this function can also be called directly from a client-side program using the code shown below. If you decide to use a function like this in your Visual LANSA development, and you do not have
the VL Accelerator, it is recommended that you create a re-usable part to interface with the Server-Side function.
USE BUILTIN(CALL_SERVER_FUNCTION) WITH_ARGS(*SSERVER_SSN FWBI01 N Y) TO_GET(#W_RTNCODE)
IF COND('(#W_RTNCODE *EQ OK)')
CHANGE FIELD(#W_DATE8) TO(#DATE8)
CHANGE FIELD(#W_TIME) TO(#TIME)
ELSE
* Error retrieving Server information from the server
MESSAGE MSGID(SBR0010) MSGF(FWMSG01)
ENDIF
CODE: FWBI01 - Server Information Interface
* Created using the STBBPGM Template
* =======================================================
* Copyright .....: (C) Surround Technologies, LLC, 2001
* Process .......: FW_BP01
* Function ......: FWBI01
* Type ..........: Server-side Function
*
* Created by ....: LEE
* Created on ....: 09/13/01 at 21:48:32
* Description ...: Server Information interface
* =======================================================
* . Purpose
* Tag: fill in the purpose of this component below
* This is used to ...
*
* =======================================================
* . Notes
* Tag: add any notes for other developer that may need to
* . work with this component below
* When editing or working with this program, ...
*
* =======================================================
* . Amendment Details
*
* Date Programr Description
* -------- -------- -------------------------------------
*
* =======================================================
* Function Summary:
* Methods:
*
* Incoming Exchange Fields:
* . Field Name - Field Description
*
* Outgoing Exchange Fields:
* . Field Name - Field Description
*
* =======================================================
* <<<<<<<<<<<<<<<< Definitions >>>>>>>>>>>>>>>>
*
* Function Control Options
*
FUNCTION OPTIONS(*DIRECT *HEAVYUSAGE)
*
* Working field definitions
*
*
* Condition definitions
* >> Standard Conditions
DEF_COND NAME(*AS400) COND('(*CPUTYPE = AS400)')
DEF_COND NAME(*CLIENT) COND('(*On_Client_System = Y)')
DEF_COND NAME(*STNDALONE) COND('*SSERVER_TYPE = NONE')
DEF_COND NAME(*BATCH) COND('(*JOBMODE *EQ B)')
DEF_COND NAME(*INTERACTV) COND('(*JOBMODE *EQ I)')
*
* Group By definitions
*
*
* List definitions
*
*
* Report line definitions
*
*
* =======================================================
* Tag: Program Mainline : FWBI01
* =======================================================
* <<<< Check for user authority to this function >>>>
*
* <<<<<<<<<<<<<<<< Initializations >>>>>>>>>>>>>>>>
*
* Tag: <<<<<<<<<<<<<< Main Logic >>>>>>>>>>>>>>>>
CHANGE FIELD(#JOBNAME) TO(*JOBNAME)
CHANGE FIELD(#USER) TO(*USER)
CHANGE FIELD(#JOBNBR) TO(*JOBNBR)
* Using *DATE because it changes dynamically,
* *MMDDYYYY does not.
CHANGE FIELD(#DATE8) TO(*DATE8)
USE BUILTIN(CONVERTDATE_NUMERIC) WITH_ARGS(#DATE8 V L) TO_GET(#DATE8)
CHANGE FIELD(#TIME) TO(*TIME)
CHANGE FIELD(#FW_SRNON) TO(*CPU_NUMBER)
CHANGE FIELD(#CPUTYPE) TO(*CPUTYPE)
CHANGE FIELD(#FW_CPFREL) TO(*CPFREL)
CHANGE FIELD(#FW_PART) TO(*PARTITION)
HANGE FIELD(#FW_PARDSC) TO(*PARTITION_DESC)
CHANGE FIELD(#FW_SRNO) TO(*UD_FW_SERIAL_NUMBER)
CHANGE FIELD(#FW_MDNO) TO(*UD_FW_MODEL_NUMBER)
*
IF COND(*INTERACTV)
DISPLAY FIELDS(#JOBNAME #USER #JOBNBR #DATE8 #TIME #FW_SRNON #FW_SRNO #FW_MDNO #CPUTYPE #FW_CPFREL #FW_PART #FW_PARDSC)
ENDIF
*
EXCHANGE FIELDS(#JOBNAME #USER #JOBNBR #DATE8 #TIME #FW_SRNON #FW_SRNO #FW_MDNO #CPUTYPE #FW_CPFREL #FW_PART #FW_PARDSC)
RETURN
*
* =======================================================
* Tag: End Program Mainline : FWBI01
* =======================================================
*
* <<<<<<<< End of Program RDML : FWBI01 >>>>>>>>
|