The Retrieve Date 2 tool provides a program interface for the
function performed by the TAA Tool RTVDAT. This allows simple access
to a date in a variety of formats with a few statements added to your
HLL Program.
The RTVDAT tool provides a command interface with return variables.
It is designed to be used in a CL program. RTVDAT2 is designed to be
used directly from a HLL program.
RTVDAT2 returns a variety of date formats in a data structure. This
includes such things as the name of the day, the name of the month, a
full date, an abbreviated date, etc. An external description is
provided for the data structure.
Two parameters are passed on the call.
** The date to be retrieved. This must be declared as a 7
position field. To request the current date, use the special
value *SYSDAT. To request any other date, enter the value in
job format surrounded by quotes such as:
MOVE '010109 ' INPDAT 7
** The return data structure. You would normally describe the
data structure using the external description provided for
TAADATLP.
The following RPG code is in a format ready to be copied into your
program:
IDATEDS E DSTAADATLP
.
.
C CALL 'TAADATLC'
C PARM '*SYSDAT' INPDAT 7 Input date
C PARM DATEDS Date DS
All of the fields in the data structure begin with the prefix DT.
Thus to use the day name value, you would specify:
C MOVE DTDYNM xxxxxx
Fields provided in the Data Structure
-------------------------------------
Field name Length Description Sample for Jan 1, 2009
---------- ------ ----------- ----------------------
DTDYNM 10 Day name Thursday
DTMTNM 10 Month name January
DTDTFL 20 Full date January 1, 2009
DTDTAB 12 Abbrev date Jan 1, 2009
DTDY3U 3 Day upper case THU
DTDY3L 3 Day lower case Thu
DTMT3U 3 Mth upper case JAN
DTMT3L 3 Mth lower case Jan
DTDYWK 1 Day of the week 5
DTDYYR 3 Day of the year 001
DTWKYR 2 Week of the year 01
DTYMD 6 YYMMDD 090101
DTCYMD 7 CYYMMDD 1090101
DTYEAR 4 Year 2009
DTCENT 1 Century 1
DTTIME 6 Time (HHMMSS) nnnnnn
DTSYSN 8 System name ssssssss
Only dates between Jan 1, 1940 and Dec 31, 2039 may be retrieved.
A year of 40 - 99 is considered to be the 20th century. A year of 00
- 39 is considered to be the 21st century. This is consistent with
the system definition.
The 'Week of year' value is based on sets of Sunday-Saturday
increments. Because Jan 1 of 2009 is a Thursday, the 1st is
considered to be Week 1.
Translation
-----------
The standard support is English. There is no need for translation if
you want the results in English.
To provide for translation for both the RTVDAT2 and RTVDAT tools, a
command is provided (CRTRTVDAT2) which will create a data area which
contains the values for day and month names in the various formats.
You should place the data area in one of your own libraries (not
TAATOOL).
You create the data area with the command:
CRTRTVDAT2 LIB(xxxx)
You then edit the data area with the EDTDTAARA2 TAA Tool command:
EDTDTAARA2 DTAARA(xxxx)
When the display appears, you follow the instructions in the data
area to key over the English values with your native language.
When the RTVDAT2 tool program is called, it checks for the existence
of a RTVDAT2 data area on the library list. If a data area is found,
it retrieves the data area value and overlays the English literals
that are used in the program.
Using this approach provides the following:
** Translation need only be done once. On the next release, your
data area will still exist and be used by a new version of the
RTVDAT2 tool.
** You can have multiple RTVDAT2 data areas on your system and
provide a different language version for any user. For
example, you could have a system standard in QGPL that would
be used unless a RTVDAT2 data area was found prior on the
library list.
Command parameters *CMD
------------------
The RTVDAT2 function is a program which you call directly from your
HLL as described previously. No command is provided.
The command CRTRTVDAT2 is used for translation. You do not need
CRTRTVDAT2 if your native language is English.
The following parameter exists for CRTRTVDAT2:
LIB The library which contains the RTVDAT2 data area
used for language translation.
Restrictions
------------
** Only dates between January 1, 1940 and Dec 31, 2039 may be
used.
Prerequisites
-------------
The following TAA Tools must be on your system:
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CRTRTVDAT2 *CMD TAADATL2 QATTCMD
TAADATLC *PGM CLP TAADATLC QATTCL
TAADATLC2 *PGM CLP TAADATLC2 QATTCL
TAADATLP *FILE PF TAADATLP QATTDDS
Structure
---------
RTVDAT2 program (Call the program TAADATLC)
TAADATLC CLP
CRTRTVDAT2 Cmd
TAADATLC2 CL pgm
|