+ Reply to Thread
Results 1 to 6 of 6

Thread: Null field support (need HELP please!)

  1. #1
    K.Forsythe Guest

    Default Null field support (need HELP please!)

    Danbo, Try adding ALWNULL(*USRCTL) to your h spec. This will allow the database files to be tested for null. However, I have never used standalone feilds that supported null values. I did not think that you could. Even the V5R2 manuals only talk about null in relation to database files. But by adding the ALWNULL keyword to the program, you should be able to test the database fields you are reading and load the standalone fields accordingly. Good luck! Kevin Kevin

  2. #2
    danbo@danbo.com Guest

    Default Null field support (need HELP please!)

    The ALWNULL keyword is already in the program. I thought, based on reading the IBM RPG Programmers reference that NULL field support was, in face, ONLY on database fields directly. Perhaps the example in Cozzi's book was a tad off, since it used 'stand alone' fields. Although it would really be nice to be able to take a database record, toss it into a data structure, and have the data structure subfields take on the same characteristics as the database, including NULL. From my personal testing, I haven't found a way to do that, much less support it.

  3. #3
    danbo@danbo.com Guest

    Default Null field support (need HELP please!)

    The following is from the V5R1 IBM RPG Programmers Reference (PDF version, page 490):
    The %NULLIND built-in function can be used to query or set the null indicator for null-capable fields. This built-in function can only be used if the ALWNULL(*USRCTL) keyword is specified on a control specification or as a command parameter. The fieldname can be a null-capable array element, data structure, stand-alone field, subfield, or multiple occurrence data structure
    This gives me the impression that stand-alone fields, even subfields, can in fact be null capable. But how? Every time I try to compile a program, even to test it, an error always is returned saying the field is not null capable. Do you need to set the field to NULL to make it null capable? Guess I'm lost on this one.

  4. #4
    danbo@danbo.com Guest

    Default Null field support (need HELP please!)

    System is V5R1. In Cozzi's "The Modern RPG IV Language" (third edition), the example given for use of %NULLIND is misleading. It shows two fields defined as standalone fields, type of date. The C specs then show how to use the %NULLIND built in function. From what I've read in the V5R1 RPG Programmers Reference, anything related to null values seems tied specifically to database fields, not fields defined as standalone ones, based off a file or fields in a file. The field in question, in my code, is a standalone field with the LIKE keyword (to define it like the database field). The database field is null capable. Simply put, one record is read from a file. If it matches some data stored in standalone fields (all with LIKE), the record is deleted. Otherwise the record read is moved into the standalone fields. This is all well and good until you get to the date field. A comparison of the data will be avoided IF the field is null. Yet you can't test the standalone field for null since the compiler keeps saying the standalone field isn't null capable. Am I missing something here? Is full null support limited to V5R2 for non-database fields? Or is there some way of defining a standalone field as null calable using some hidden keyword I can't find? If anyone has any insight into this, I'd greatly appreciate it. Thanks in advance...

  5. #5
    Guest.Visitor Guest

    Default Null field support (need HELP please!)

    This is a kludge work around but will allow work fields in the program to have the null capabilities. Define a second input file, which will be used as the definition for the work fields. This allows you to use the second set of fields with the %nullind capabilities. The attached code shows an example. As stated, the documentation leads us to believe you can use null standalone fields in a program. BUT, the compiler does not agree. I'm at V5R1 Hope this helps in your quest.
    Code

  6. #6

    Default Null field support (need HELP please!)

    Danbo wrote: > > System is V5R1. > > In Cozzi's "The Modern RPG IV Language" (third edition), the example given for use of %NULLIND is misleading. It shows two fields defined as standalone fields, type of date. The C specs then show how to use the %NULLIND built in function. > > From what I've read in the V5R1 RPG Programmers Reference, anything related to null values seems tied specifically to database fields, not fields defined as standalone ones, based off a file or fields in a file. The field in question, in my code, is a standalone field with the LIKE keyword (to define it like the database field). The database field is null capable. > Indeed even with ALWNULL(*USRCTL), null-capability is restricted to database fields. The only way a standalone field could be null-capable is if the field is null-capable in one of the externally-described files. If you do LIKE of a null-capable field, you don't get a new null-capable field. Starting in V5R2, through an early PTF (for apar SE06449), you can also get null-capable subfields in externally-described files, data structures defined using LIKEREC, or defined using LIKEDS (where the parent DS was externally-described or defined with LIKEREC).

+ Reply to Thread

Similar Threads

  1. Question about null values in field
    By Guest.Visitor in forum RPG
    Replies: 15
    Last Post: 09-29-2006, 09:28 AM
  2. Identifying position of first null character in field
    By buck.calabro@commsoft.net in forum RPG
    Replies: 3
    Last Post: 07-28-2004, 07:30 AM
  3. Replies: 3
    Last Post: 07-22-2003, 05:55 AM
  4. Checking for null data in a field
    By gary.shipp@s3t.co.uk in forum Programming
    Replies: 2
    Last Post: 06-05-2001, 02:26 PM
  5. Reading File with Null-Value Field
    By Guest.Visitor in forum Application Software
    Replies: 5
    Last Post: 11-27-2000, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts