Solved

Null Fields

Posted on 2006-11-17
7
945 Views
Last Modified: 2008-01-09


Can you use a Display file( DSPF)in Maintenance program (RPGLE )
to update values in a PF where some of the fields( but not all) allow NULL values

Thanks in advance.
0
Comment
Question by:Philip_Lang
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 17964072
Hi Philip.
The answer is yes. When writing a program you are in totla control of the IO.
RPG allows compile opttions to allow Null fields, these are then converted

ALWNULL(*NO | *INPUTONLY | *USRCTL)      

or in the H spec use
H ALWNULL(*NO | *INPUTONLY | *USRCTL)      

Dave
0
 

Author Comment

by:Philip_Lang
ID: 17964111
Hi Dave,
Yes, I have included the *ALWNULL in the compile
In the program I'm checking the value entered into the DSPF field using the %NULLIND
but as the DSPF field is not NULL, but the field on PF I'm trying to update is NULL I'm getting an Error!
Apologies if I'm confusing you , may be there is a simpler way
Thanks
0
 
LVL 14

Expert Comment

by:daveslater
ID: 17964146
have you used *Yes or *USRCTL

*USRCTL      
Specifies that the ILE RPG program can read, write and  update records with null values from externally described database files. Records with null keys can be retrieved using keyed operations.  The program can determine whether a null-capable field is actually null, and it can set a null-capable field to be null for output or update.  The programmer is responsible  for ensuring that fields containing null values are used correctly within the program.

*YES is the same as *INPUTONLY
The program cannot do any of the following:                                      
 o  use null-capable key fields                      
 o  create or update records containing null-capable  
 o  determine whether a null-capable field is actually null while the program is running                
 o  set a null-capable field to be null.                                                                        

Dave
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Philip_Lang
ID: 17964189
Dave,

Program compiled with *ALWNULL set to *USRCTL

The field on PF is defined
VMTEST         1  0       ALWNULL

when I enter a value on DSPF Field eg 1
program updates the PF , but the file still has NULL when I view the file.
0
 
LVL 14

Expert Comment

by:daveslater
ID: 17964293
is the field name on the dspf VMTEST or id it called somthing different?

In the past I have always used a different name in the DSPF
id
VMTEST        
&
TESTF1

then done a
eval VMTEST = TESTF1.

Dave
0
 

Author Comment

by:Philip_Lang
ID: 17964316
Dave,

DSPF file Field is S@TEST
then
eval VMTEST = S@TEST
Philip
0
 
LVL 14

Accepted Solution

by:
daveslater earned 125 total points
ID: 17964461
hi
the logic should be

eval VMTEST = S@TEST
eval %NULLIND(VMTEST) = *off
Update Format

Dave
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

5 Ways to automate alert management in ConnectWise // The art of alerting is in automation. When humans are removed from the alerting process, errors are fewer and action is almost immediate. But how do you automate the alerting process and what …
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question