Solved

Null Fields

Posted on 2006-11-17
7
946 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AS400 DAYOFWEEK(GENERAL DATE) 12 445
Define external data structure with free d specs in RPG 4 453
AS400 Printing 10 291
Using the QLIRLIBD 2 39
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.

734 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