|
Thanks Jonathan and Birggita. It worked fine!! Except that I had to use Compile option *CVTOPT as *TIMEDATE as the compiler did not accept the DATE/TIME fields. However this changed the Date field format to Character....so could not move TIME result directly into the PF date field , but had to add seperators '-', etc and then write to the file. Regards, Sachin -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Hauser, Birgitta Sent: Friday, August 05, 2005 2:51 AM To: 'rpg400-l@xxxxxxxxxxxx' Subject: Help in using DATFMT in RPG/400 >>1. Why can't I use DATFMT(*ISO) with DATSEP('/') for a field in Physical file? >>If it is a limitation ...any workaround ? >>The default for *ISO is yyyy-mm-dd. A date is always stored as binary value. The date format specified in an physical file does nothing else then to convert the binary value into a readable representation. For all date formats with a 4 digit year the date separator is predefined and cannot be changed. For all date formats with a 2 digit year the date separator you can choose between several date separators. >>2. While displaying this field on to a Subfile, can I convert it to yy/mm/dd >>using some edit code or I have to do the conversion in RPG code and then >>display it? In an display file you can add DATFMT(*YMD) for an date field (data type L). DATFMT(*YMD) will convert a date into a YY/MM/DD representation of the date. >>3. Another problem is that I am using TIME to retrieve the current system date >>(can't use UDATE/*DATE which gives job date so it doesn't change if job was >>started just before midnight). But TIME does not give century (out put for time >>is yymmddhhmmss). How can achieve that in RPG code? I want to store the output >>to PF field mentioned in point 1. One way would be retrieving century from >>*YEAR, and rest of the date-time from TIME opcode! Wanted to know if I am >>missing any opcode, which could do it directly!! If you define the output field for time with 14,0 the century will be returned. If you are using RPGIV, than you can fill your date field in your file by: 1. using the TIME operation code with the Date field from your physical file as result field. 2. using the %Date() built-in-function without specifying any parameter and the date field from your physical file as result field Birgitta
As an Amazon Associate we earn from qualifying purchases.
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.