AS400 hundred year date format I had to pull records from two files with a matching date value in each file. To make things interesting, the date on one file was stored in timestamp format and the date field in the other file was stored in hundred year date format. SQL (and QUERY400) can very

Read More

Why these weird AS400 iSeries Date formats? Back in the good old days of single megabyte disks the size of a shoebox, when hard drives were called Winchester Drives and the only phones we used were actually used for making telephone calls, size was everything (insert slightly rude joke here). In the daily effort to

Read More

I wanted a handy little RPG code snippet to return the day name for a date. My requirement was to  feed in a date like “Nov 30 2017” and it to tell me that its ‘Thursday’. Google to the rescue, I found a nice little article by RAFAEL VICTORIA-PEREIRA (Thankyou Sir!) which has a code sample

Read More

So, we had a file coming in from an external partner today – containing a date in Julian Format. Or what I initially thought to be Julian format. Many applications (especially mainframe systems) store dates in the Julian format. Julian dates (abbreviated JD) are simply a continuous count of days and fractions since noon Universal

Read More

To convert a RPG DATEFIELD to this numeric 8,0 field with no ‘/’ or ‘-‘ do this: D USADate 8s 0 USADate = %dec(%char(DateField:*iso0):8:0); Or another even neater function is this: I prefer this %UNS built in function, since it does not require me to specify length and decimal position parameters. What is %UNS? %UNSH

Read More

Here’s the other date conversion – It’s a JBA date (7,0 numeric) to 8 character alpha in JIS format (YYYYMMDD) with no separators. If you want separators in your result then simply expand the result field by 2 characters (to 10) and replace the “0” in the “*jis0” with what ever separator you prefer. Eval

Read More

Heres one to change a 6,0 numeric date in MMDDYY form to 7,0 numeric date in CYYMMDD form. Eval INTERNAL_DATE = %dec(%char(%date(EXTERNAL_DATE:*mdy) :*cymd0):7:0) INTERAL_DATE is the 7,0 CYYMMDD date. EXTERNAL_DATE is the 6,0 MMDDYY date. Convert RPG Datefield %DATE into a signed numericTo convert a RPG DATEFIELD to this numeric 8,0 field with no ‘/’

Read More