Ask the Expert

Using 15,000 line RPG programs

I have a strange problem with a 15000 line RPG program in which all of the 99 indicators are used. I need at least one more indicator to use in the display file the program uses. I need to use that one in the display file to protect a field from updating.
15,000 line RPG programs shouldn't be allowed; there is always a better way. But I assume that this is a legacy program. If it is ILE, then it is disgraceful! You can condition a field in a display file without indicators. Create a field in the record format as a 'program-to-system' field ("P" in position 38, size 1 alpha character). Say the field is called P#CUST where the display field you want to control is called D#CUST. It would look like this:


        A            P#CUST         1A  P

Now add a DSPATR to the field you want to condition :

        A            D#CUST        11   B      DSPATR(&P#CUST)

In your program, create a hex value for each display attribute you want to use :

        C              BITON'25'     HXOGUS
Green underscore open
        C              BITON'02'     HXPGRN
Green normal protected

HXOGUS is Hex 24, HXPGRN is Hex A0. 

Now in your program when you want the field to be open for the user to change its value, set P#CUST to HXOGUS before you EXFMT (or WRITE/READ) the format. It will appear in green and underlined, and the user can change its value.

When you want to protect the field set P#CUST to HXCGRN. Now when you EXFMT the format the field will be in green, without underlines, and protected. No indicators have been used.

Read the OS/400 DDS Reference manual section on valid P-field values for a list of the hex values that are allowed in the program-to-system field.

This was first published in October 2005

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: