PL/I

PL/I

PL/I

 View Only
  • 1.  PL/I & XML: Date format conversion

    Posted Mon January 02, 2017 02:04 AM

    When using a datetime field in a webservice and you have a Java client, then the timestamp is sent in a format like 2001-10-26T21:32:52.12679, on MF we need to convert it to a timestamp of a CHAR(17). Are there any builtins or known best practices which we could use to convert this datetime format.

     

    Leo Mathew


  • 2.  Re: PL/I & XML: Date format conversion

    Posted Tue January 03, 2017 02:31 AM

    Hi Leo

    Did you take a look at the builtin TRNASLATE?

    It can do many things like:

    NEW_DATE = TRANSLATE ('12.34.56', DATE, '563412');

     

    PeterOL


  • 3.  Re: PL/I & XML: Date format conversion

    Posted Tue January 03, 2017 11:29 PM

    Thanks Peter for your suggestion.

    Leo Mathew


  • 4.  Re: PL/I & XML: Date format conversion

    Posted Wed January 04, 2017 02:59 AM

    You are welcome

    When I read the question I am a little confused but it seems you know what you want for some specific use.

    Just to be sure. But a real timestamp on mainframe using DB2 would be CHAR (26) so it must be because you don't need this timestamp for DB2 but some other place where CHAR (17) will do.

    If you don't like the one command style like TRANSLATE you can of course use normal SUBSTR and concatenation.
    I do like the many functions build into PL/I - it is a really great language and anything is possible.

    Regards Peter - "live is too short for languages starting with C"

    PeterOL


  • 5.  Re: PL/I & XML: Date format conversion

    Posted Tue January 03, 2017 09:39 AM

    Leo,

    Your question is still flagged with "This question has not been answered yet."

     

    I believe that Peter has answered your question -- use the TRANSLATE built-in function.

    Robin400