× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Build Timestamp
  • From: boothm@xxxxxxx
  • Date: Sun, 28 Sep 97 12:36:49 -0400
  • In-Reply-To: <c=GB%a=Infonet%p=Tengizchevroil%l=TENGIZCHEV/KZSITE01/00069BF6@kz-tz-hv-msx01.ten

I just copied this out of the ILE RPG manual on the Redbook site.  This is
from the V3R2 bookshelf.  This may have the answer, then again it may not.
---------------------------------------------------

4.3.15.2 Moving Date-Time Data


The MOVE and MOVEL operation codes can be used to move Date, Time and
Timestamp data type fields. 

The following combinations are allowed for the MOVE and MOVEL operation
codes: 

     Date to Date 

     Time to Time 

     Timestamp to Timestamp 

     Date to Timestamp 

     Time to Timestamp (sets micro-seconds to 000000) 

     Timestamp to Date 

     Timestamp to Time 

     Date to Character or Numeric 

     Time to Character or Numeric 

     Timestamp to Character or Numeric 

     Character or Numeric to Date 

     Character or Numeric to Time 

     Character or Numeric to Timestamp 


| Factor 1 must be blank if: 


     | The source or target of the move is a timestamp field 

     | Both the source and the target of the move are date or time fields 


| Otherwise, factor 1 contains the date or time format compatible with the 
| character or numeric field that is the source or target of the operation. 
| Any valid format may be specified. 


| Keep in mind the following when specifying factor 1: 

     Time format *USA is not allowed for movement between Time and numeric 
classes. 

     A special value (*JOBRUN) can be specified in factor 1 if the format of 
the source or
     target character or numeric field is based on the run-time job attributes 
(DATFMT,
     DATSEP and TIMSEP). If *JOBRUN is used for formatting a Time field and the 
Result
     field is character, the resulting format will be HHMMSS using the TIMSEP 
from the
     job. 


     | The format *CYMD is allowed in factor 1. *CYMD0 can be specified in 
     | factor 1 if the source or target is a character field with no 
     | separators. (For more information on *CYMD format see "*CYMD Format" 
     | in topic 2.3.4.1.) 


     | A two-digit year format (*MDY, *DMY, *YMD, and *JUL) or a three-digit 
     | year format (*CYMD or *CYMD0) can only represent dates in the range 
     | 1940 through 2039. An error will be issued if conversion to a two- or 
     | three-digit year format is requested for dates outside this range. 

Factor 2 is required and may contain a character or numeric, Date, Time or
Timestamp field; array; array element; a literal; or a named constant, to
be converted. 


| The following rules apply to factor 2: 

     In general, if the field specified in factor 2 is character, it must 
     | have separator characters, for example 09/06/91. However, if the 
     | format in question is *CYMD0, then no separators are required for the 
     | character field. 

     Separator characters must be valid for the specified format. 

     If factor 2 is not a valid representation of a date or time or its format 
does not match the
     format specified in factor 1, an error is generated. 


     | If factor 2 contains UDATE, the factor 1 entry must be a date format 
     | with a 2-digit year. If factor 2 contains *DATE, the factor 1 entry 
     | must be a date format with a 4-digit year. 

The result field must be a Date, Time or Timestamp field or a numeric or
character class field, array or array element. The date or time is placed
in the result field according to its defined format or the format code
specified in factor 1. If the result field is numeric, separator
characters will be removed, prior to the operation. The length used is the
length after removing the separator characters. 

When moving from a Date to a Timestamp field, the time and microsecond
portion of the timestamp are unaffected, however the entire timestamp is
checked and an error will be generated if it is not valid. 

When moving from a Time to a Timestamp field, the microseconds part of the
timestamp is set to 000000. The date portion remains unaffected, but the
entire timestamp will be checked and an error will be generated when it is
not valid. 


| When moving a value to a date field, keep in mind that factor 1 determines 
| the number of digits to be moved. If the format of Factor 1 contains 6 
| digits as in the case of *YMD, and Factor 2 is a numeric field, the 
| rightmost 6 digits of Factor will be converted to the date. 


| The P operation extender can only be specified if the result field is 
| character, graphic, or numeric. 

Subtopics: 

     4.3.15.2.1 Examples of Converting a Character Field to a Date Field 

---------------------------------------------------
Booth Martin       Contract Programming, Inc.
---------------------------------------------------



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.