Warning: Declaration of TCB_Menu_Walker::walk($elements, $max_depth) should be compatible with Walker::walk($elements, $max_depth, ...$args) in /home/nicklit/www/www/wp-content/plugins/thrive-visual-editor/inc/classes/class-tcb-menu-walker.php on line 620

Warning: session_start(): Cannot start session when headers already sent in /home/nicklit/www/www/wp-content/plugins/userpro/includes/class-userpro.php on line 222
When is the DFT keyword in PF used for? - Nick Litten is IBM-i, AS400 iSeries RPG Programmer and Nerd

When is the DFT keyword in PF used for?


Sep 25

The DFT Keyword is used specify the default value of a field in the Physical File. The format of the keyword is:

DFT('value' | numeric-value | X'hexadecimal-value' | *NULL)

Without this keyword, character and hexadecimal fields are set to blanks as default and numeric fields are set to zeros as default. However, if you specify the ALWNULL keyword for the field, then the character, hexadecimal, and numeric fields are set to the null value as default.

This keyword does not affect the physical file on input operations.


The following example shows how to specify the DFT keyword.

  CHARFLD1   20A   DFT('Sample field')
  CHARFLD2    5A   DFT(X'D985955185')
  HEXFLD1     3H   DFT('ABC')
  HEXFLD2     3H   DFT(X'C1C2C3')
  NUMFLD1     5S 0 DFT(99999)
  NUMFLD2     5S 2 DFT(999.99)
  NUMFLD3     5S 2 DFT(999)
  NUMFLD4     5S 2 DFT(*NULL)
  NUMFLD5     5S 2 DFT(999.99)
  TIMFLD1      T   DFT('11.15.00')

The default value for CHARFLD1 is ‘Sample field’. The default value for CHARFLD2 is hex D985955185. The default value for HEXFLD1 is C1C2C3 (the hexadecimal representation of the character constant). The default value for HEXFLD2 is C1C2C3. The default value for NUMFLD1 is 99999 (no decimal character is required because the field has zero decimal positions). The default value for NUMFLD2 is 999.99. The default value for NUMFLD3 is 999 (no decimal character is required if you do not need to specify decimal values). The default value for NUMFLD4 is the null value (ALWNULL is a required keyword for the field if DFT(*NULL) is specified). The default value for NUMFLD5 is 999.99; the field also allows the null value. The default value for DATFLD1 is 12-31-91. The default value for TIMFLD1 is 11.15.00 (*ISO format).

You big silly.

Isn’t it obvious?

Now you feel silly for googling that right?


About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.