How to code INDSS

Use this board for starting discussions, asking questions, and giving advice on RPG programming for the IBM i platform (and predecessors.)
tony_wycihowski
New User
Posts: 2
Joined: Thu Jun 11, 2020 3:30 pm
First Name: tony
Last Name: wycihowski
Company Name: IES
Phone: 270-792-8277
State / Province: Tennessee
Contact:

How to code INDSS

Post by tony_wycihowski »

How do you get to declare INDDS in profound designer?


Thanks
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: How to code INDSS

Post by Scott Klement »

The INDDS keyword is a feature of RPG, so is coded in your RPG program, not in the Profound UI Visual Designer.

Here's an example... let's say I'm creating the following screen:
indds1.png
indds1.png (9.5 KiB) Viewed 16175 times
I want my 'Cancel' button, when clicked, to turn on an indicator named 'Cancel' in the RPG program. How do I do that? Well, there are two ways:
  1. I can use Profound UI's named indicators. If I do this, there's no need to code INDDS. This is what I would recommend.
  2. I can use a numeric indicator in the display such as *IN12, but then map it to a named field in the RPG using INDDS. I don't like this approach as much because it means you have two different names to remember, its *IN12 in the display file, but 'Cancel' in the RPG program. In the green-screen days we didn't have option 1, above, so this was our only other alternative besides using the numeric indicator throughout. This can still be a good alternative if you want to convert existing applications but don't want to take the time to rewrite them.
Option 1: Using a Profound UI named indicator

Bind the response property of the button to a name, in this case 'Cancel', but set the data type to indicator:
indds2.png
indds2.png (6.53 KiB) Viewed 16175 times
Inside the RPG program, you can now refer to it by name. No need to code INDDS at all.

Code: Select all

dcl-f CUSTMAINTD workstn handler('PROFOUNDUI(HANDLER)');

dou Cancel = *on;

  exfmt GETCUST;

enddo;
There is a caveat to this approach, however. Since DDS doesn't support named indicators, the Visual Designer will actually define your field as 1A (or char(1) in the newer notation) in the display file. Therefore its possible for the field to be blank instead of '0' at times. In the above example, I was careful to only check it for *ON, and to check it after the exfmt ran. With a little bit of care like this, it works perfectly, and can be referred to as 'Cancel' both in the display and the program, which makes maintenance a lot easier.

Option 2: Using the Older RPG INDDS Feature

This isn't really a Profound feature, this is a feature that IBM added to RPG a long time ago. The idea here is that DDS only supports numbered fields as indicators, and the people at IBM who made the RPG compiler had no power to change that. So, they created a way where the DDS can use a numbered indicator, and RPG can map that numbered indicator to a named indicator within your RPG program.

As I said, above, I don't recommend this technique because it requires you to remember that the name is different in the DDS vs. the RPG. But, that's up to you, I guess. If you've converted a big application, it might be too much work to convert everything to option 1, so this might be the next-best-thing.

To use this technique, you bind the 'response' property of the 'cancel' button to a numeric indicator. The most common convention for a cancel button would be *IN12 (because F12 was normally used for cancel in green-screens)
indds3.png
indds3.png (7.22 KiB) Viewed 16175 times
To use INDDS, RPG also requires that indicators be communicated in a special "indicator area." This is the same as it would be in green-screen, it is done with the INDARA DDS keyword. To code INDARA in Profound UI, you use the "File Keywords" dialog. To do that:
  1. Click "File Keywords" in the Visual Designer Ribbon
  2. Type INDARA in the box where it says "Specify items to add to list"
  3. Click "Add"
  4. Click "Ok"
indds4.png
indds4.png (30.1 KiB) Viewed 16175 times
On the RPG side of things, you need to code the INDDS keyword on your DCL-F (or F-spec in fixed format) and have it point to a data structure. the data structure should have a named indicator ('Cancel' in this example) in the position that corresponds to the indicator number (position 12 in this example.) Same as green-screen.

Code: Select all


dcl-f CUSTMAINTD workstn handler('PROFOUNDUI(HANDLER)')
                         indds(ScreenInds);

dcl-ds ScreenInds qualified;
  Cancel ind pos(12);
end-ds;

dou ScreenInds.Cancel = *on;

  exfmt GETCUST;

enddo;
Hope that helps!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests