Ask the Expert

Working with nulls in RPGLE

We are in the process of externalizing our I/O from our RPGLE Programs. We are also using more and more Forge in Keys that may contain nulls.

Is there a way to bring the row back and have a flag or indicator on an external data structure to handle the nulls? I am currently creating individual work fields for the null indicators.

Also, are there any plans to allow the RPG Programs to receive a Cursor that was created in a Stored Procedure?

With nulls, you can still fetch into a data structure. Simply specify the data structure followed by another data structure (array) that will hold the values of the null indicators. Define same number of elements in this array as there are fields in the data structure -- in the case of the example below, this is 12.


* CustomerRow -- an externally described data structure based on SQL view allCusts
d customerRow e ds extname(allCusts) qualified

* Null indicator arrays
d customerNIArr s 5i 0 dim(12)

FETCH custListCursor INTO :customerRow :customerNIArr;

This was first published in September 2007

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: