Solved

Null Fields

Posted on 2006-11-17
7
938 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now