Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 959
  • Last Modified:

Null Fields



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
Philip_Lang
Asked:
Philip_Lang
  • 4
  • 3
1 Solution
 
daveslaterCommented:
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
 
Philip_LangAuthor Commented:
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
 
daveslaterCommented:
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Philip_LangAuthor Commented:
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
 
daveslaterCommented:
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
 
Philip_LangAuthor Commented:
Dave,

DSPF file Field is S@TEST
then
eval VMTEST = S@TEST
Philip
0
 
daveslaterCommented:
hi
the logic should be

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

Dave
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now