Access a File with Null Capable Fields

LANSA

Access a File with Null Capable Fields
Example 231 - Rating: specific advanced
The Things that Make Up this ExampleTo Execute this Example

This example demonstrates how LANSA functions can access files that have been defined as having null capable fields.



A null capable field is a field that can contain the value X’00’. It is not possible to create files with such fields using LANSA, but if such a file has already been created using DDS, it is possible to make the file known to LANSA as an OTHER file, and for LANSA programs to read from the file, and write to it. (but not to position to a null key value, if the null capable field is a key field).

There are two ways to handle null capable fields: Method A and Method B.

Notes and Suggestions

Files with null capable fields are defined under OS/400 using DDS and the ALWNULL parameter. See S231PFA DDS and S231PFB DDS for examples.

If an ordinary LANSA file IO module references a record with a null character X’00’ in a null capable field, the job will crash with error CPF5035 – “Data mapping error on member… error code 19”. In order to define a file with null capable fields to LANSA at the time the file IO module is compiled you need the following:
  • The OS/400 release must be V4R1M0 or greater, and the target release in LANSA data area DC@A07 must be V4R1M0 or greater. To run this SET example V4R2M0 or greater is required.
  • The OS/400 command CRTRPGMOD must have the default for the ALWNULL parameter of *USRCTL. Be extremely careful when changing this command parameter default as you may be changing the behaviour of your iSeries for all other developers – See the IBM manual for CHGCMDDFT. One way of doing this is to run the following from a command line: CHGCMDDFT CMD(CRTRPGMOD) NEWDFT(‘ALWNULL(*USRCTL)’) You can change this back to the way it was when you have finished compiling the file.
  • The LANSA data area DC@OSVEROP must contain *RPGIV so that when the IO module is compiled, the RPG ILE commands in the virtual field logic will be recognized. You can change this back to the way it was when you have finished compiling the file.
This Example Also Demonstrates:
  • Enter RPG IV code into virtual field logic
  • Define OTHER files
This Example Is Useful Because:
  • One day you might have to write a LANSA interface to an application that uses files that have null capable fields that contain the null character X’00’
Keywords
Example 231Null capable fields
ILERPG IV
ALWNULLOTHER files