Browser utilities

Tools

Utilities for recurring IBM i tasks: date and numeric format conversion, data reading, command generation. They run in the browser, with no installation.

Calculations happen on the device in use. Entered data is not transmitted to the server.

IBM i date converter

Type a date in any format and get it in all the others, CYYMMDD and Julian included.

12607272026-07-27

Why does CYYMMDD exist?

A 7-digit numeric field whose first digit is the century: 0 for 1900, 1 for 2000. It was born to fit a date into very little space and cross the millennium without ambiguity, once two digits for the year were no longer enough. It costs one byte more than YYMMDD and saves one against YYYYMMDD: a trade-off still sitting inside a great many production files. Watch out for six digits: 260727 can be either YYMMDD or Julian CYYDDD, and only the file layout can tell you for sure.

Packed and zoned decimal

How a number is really written to disk, byte by byte, and how much room it takes.

123.4512 34 5C

How to read these bytes

In zoned decimal every digit takes a whole byte: the high nibble is F and the low one holds the digit. In packed decimal two digits share a byte, so it takes nearly half the room. In both, the last nibble carries the sign: C positive, D negative, F unsigned. The decimal point is never stored: it lives only in the field definition. This matters when you stare at a record in hex through DSPPFM and F10, or when you need to know what a file will really weigh before you create it.

Record layout

Which byte each field starts at, how long the record is, and how much the file will weigh.

A(10) P(5,2)pos. 1-10, 11-13

One field per line: name, type, length, decimals. Types are A (character), P (packed), S (zoned). The DDS style is accepted too, such as CUSTNO 7P 0.

DDS to SQL

Paste the DDS of a physical file and get the matching CREATE TABLE.

A R CLIENTECREATE TABLE

What it covers and what it does not

Field definitions are read — name, length, type, decimals — along with the record format and key fields. Type mapping is: A to CHAR, P to DECIMAL, S to NUMERIC, L to DATE, T to TIME, Z to TIMESTAMP, B to SMALLINT, INTEGER or BIGINT depending on length. A field with no explicit type is zoned when it has decimals and character when it does not, as DDS requires. Comments come out as --, and fields that cannot be translated come out commented in full, so the CREATE TABLE still runs and the column to fix by hand stays in sight. Two options change the result: NOT NULL on every field, and long names taken from the description — COLHDG first, then TEXT — with the DDS name kept as FOR COLUMN, the system name RPG programs go on reading the file with. Validation keywords, default values and fields defined by reference are left out, and flagged rather than guessed: the result is a starting point to read through, not something to run blind.

RPG edit codes

Shows how a number is printed by each of the sixteen edit codes, with the three properties that tell them apart.

-1234.561.234,56CR · -1.234,56

With sign and decimals, as held in the field. Leading zeros are kept: codes X and Z need them. Third parameter of %EDITC. Leave empty for none.

How to read the table

The sixteen codes are every combination of three choices: thousands separator yes or no, zero value printed or left blank, negative sign absent, CR, trailing minus or minus in front of the number. Non-significant zeros are always suppressed, which is why 0.05 prints as .05. On positive values the sign positions stay empty: that is deliberate, and it is what keeps the columns of a report aligned. The special codes do something else: X leaves the digits as they are, Z strips the sign and leading zeros, Y inserts the slashes of a date — but which group is the day and which the month is decided by DATEDIT in the program, not by the code.

Is a tool you would often use missing? Let us know, gladly.