Solved

Null Fields

Posted on 2006-11-17
7
939 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ruby - Rails - iSeries 3 246
Setup SFTP for internal iSeries servers 8 960
Find Date Difference in AS400 Query 11 414
how to apply the SSL on iseries and WAS application 1 114
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

919 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

15 Experts available now in Live!

Get 1:1 Help Now