Q

Using 15,000 line RPG programs

Ine Search400.com user writes, "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." Application development expert John Blenkinsop responds.

This Content Component encountered an error
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:

 

        AAN01N02N03T.Name++++++RLen++TDpBLinPosFunction
        A            P#CUST         1A  P

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

        AAN01N02N03T.Name++++++RLen++TDpBLinPosFunction
        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

Dig deeper on iSeries application development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close