Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
hi all,
i have a date field in a file, that is 6.0 ymd format. i added an *iso date field to that file and wrote a simple rpg program to populate the new field.
using SQL, i viewed the file. it showed the date field being 01/01/81. after several frustrating rewrites of a 3 line RPG program, i used UPDDTA to look at the records. all of the records are in the proper 1981-01-01 format.
any ideas as to why the data is populated correctly, but SQL shows the date in mm/dd/yy but UPDDTA shows it as ccyy-mm-dd as proper? based on this, how do i prove that the data in the file is correct or not?
thanks.
-sarge
If you are using the green screen SQL interface (STRSQL), then the date format that dates are displayed in can be changed using F13=Services and take option 1=Change session attributes.
okay. never used that feature before, in StrSql. for whatever reason, i expected the display to show the date in the format, defined by the PF.
lives and learns.
thanks.
-sarge
Dates, in RPG, come in as *ISO format regardless of how they are defined in the externally described files. Seeing the date as an *ISO format in debug is correct, typically.
You can modify it by setting the default date format on the File or at the Field-level but most people don't find that feature too intuitive.
I typically use DSPPFM to show the data in the file. However remember, that all interfaces, including SQL extract the date from its 4-byte integer internal format and translate it to the DATFMT specified on the field definition or to the host HLL default date format.
agreed, bob. and i would normally use DSPPFM myself, but the radical in me decided to browse using SQL and got the suspect looking data. silly me for tyring to be innovative...... :)
-sarge