× 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.



The window is 1940 through 2039.  A birthdate of Oct.25, 1938 will be
converted to Oct.25, 2038.

There are two ways I like for doing your problem:  

1) call a small CL program with a parm of the date.  In the CL program use
the CVTDAT 
 Here's a sample:
<pre>
*************** Beginning of data ***********************************
             PGM        PARM(&DATEIN &DATE68 &ERROR)                  /*
.............................................................. */  /*
..........THIS PROGRAM SIMPLY swaps date                       */  /*
.....   parm 68 = 6 to 8, parm 68 = 8 to 6                   . */ 
             DCL        VAR(&DATEIN) TYPE(*CHAR) LEN(8)              
             DCL        VAR(&DATE6) TYPE(*CHAR) LEN(6)               
             DCL        VAR(&DATE68) TYPE(*CHAR) LEN(2)              
             DCL        VAR(&ERROR) TYPE(*CHAR) LEN(1)               
             CHGVAR     VAR(&ERROR) VALUE('0')                       
                                                                     
         /* If PARM is 86, then convert:                          */ 
             IF         COND(&DATE68 *EQ '86') THEN(DO)              
             CVTDAT     DATE(&DATEIN) TOVAR(&DATEIN) FROMFMT(*YYMD) +
                          TOFMT(*MDY)                                
             MONMSG     MSGID(CPF0500) EXEC(CHGVAR VAR(&ERROR) +     
                          VALUE('1'))                                
             ENDDO                                                   
                                                                     
         /* If PARM is 68, then convert:                          */  
             IF         COND(&DATE68 *EQ '68') THEN(DO)               
             CHGVAR     VAR(&DATE6) VALUE(&DATEIN)                    
             CVTDAT     DATE(&DATE6) TOVAR(&DATEIN) FROMFMT(*MDY) +   
                          TOFMT(*YYMD)                                
             MONMSG     MSGID(CPF0500) EXEC(CHGVAR VAR(&ERROR) +      
                          VALUE('1'))                                 
             ENDDO                                                    
                                                                      
             ENDPGM                                                   
****************** End of data *************************************** 
</pre>

2) or, write yourself an RPGLE blackbox that does similar, and call it.  

In any event, a little utility like this becomes really handy. The
advantage of the RPGLE solution is that you also can do date math later on
withthe same program.


In <352B8A6F.C2E54265@pattonville.k12.mo.us>, on 04/08/98 
   at 09:32 AM, Jerry Keppler <kepplerj@pattonville.k12.mo.us> said:


>I have a need to convert a 6-digit numeric date data to a date data type
>field of *USA  inside an RPG program.  Can anyone tell me how the AS/400
>determines the century for this type of conversion?

-- 
-----------------------------------------------------------
boothm@ibm.net
-----------------------------------------------------------

+---
| 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 MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.