question mark to invoke help routine

Hi
I have an array in the map which when I put “?” in the field, I like to know the position of question mark in this array. so when I select the field from the help routine I like to go back and replace that position with new selected value.

In the Define Data Parameter of the Helproutine, you can define another parameter following the definition of the help-field, in format I2, and that parameter will automatically contain the index of the array on which you placed the question mark.

DEFINE DATA PARAMETER
1 HELP-FIELD (A10) /* the field that triggered this helproutine
1 ARRAY-INDEX (I2) /* The index
END-DEFINE

Hi
Thank you for the help
my help on the map is like this at the moment.

HE= ‘PAL530H’,#PDA-SELECTION-FIELD,
#INPUT-CIDS-FLAG-MESSAGE(),___
#INCIDENT-DESC1(
)
and helproutine is

DEFINE DATA

PARAMETER
01 #PDA-SELECTION-FIELD (A1)
01 #PDA-CIDS-FLAG-MESSAGE (A1/1:V)
01 #INCIDENT-DESC (A40/1:V)

are you suggesting to add this field at the end. and where do I have to define it on the map?

RTFM!
[url]http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat422mf/pg/pg_obj_help.htm#Array_Indices[/url]
It took me 1 minute to find the topic!

Hi,

The field that contains what you wrote above “HE= ‘PAL530H’,#PDA-SELECTION-FIELD, #INPUT-CIDS-FLAG-MESSAGE(),___ #INCIDENT-DESC1()” should be defined in the helproutine as the LAST field in the define data parameter and therefore i conclude that it is missing in the above quote. You may pass up to 20 parameters to a help routine, the field that the helproutine is invoked from IS NOT written as a parameter in the map, as the index is also not written in the HE and does not have to be defined anywhere in the map. These two fields (the field itself and the index) are not specified as parameters in the “HE=” but have to be specified as the 2 last parametewrs in the define data parameter of the helproutine.

In the given example, ‘PAL530H’ is the help routine. I learn that helpmap name can be given here as well. Is that true? Is there any distinction in the syntax that is evident from the code generated by the mapo editor? i.e., to identify without using the map editor.

HE= ‘PAL530H’

I tried that
and at the moment it is like this
DEFINE DATA
GLOBAL USING COP000G
**SAG DEFINE EXIT PARAMETER
PARAMETER
01 #PDA-SELECTION-FLAG (A1)
01 #PDA-CIDS-FLAG-MESSAGE (A1/1:15)
01 #INCIDENT-DESC (A40/1:15)
01 #FINDEX1 (I2)
*

‘PAL530H’,#PDA-SELECTION-FIELD,#INPUT-CIDS-FLAG-MESSAGE(),
#INCIDENT-DESC1(
)_________________________________________

and I get this
A syntax/runtime error has occurred.
Source line … 0088
Error number … 0936

Press enter to call the map editor for error recovery

Format/length conflict in parameter 4 (Helproutine PAL530H/COPLIB/9/124).

Here is a program, map, and helproutine that do what you want:

program first:

                                  > +  Program     HARR1    Lib XSTRO    

All …+…1…+…2…+…3…+…4…+…5…+…6…+…7…
0010 DEFINE DATA LOCAL
0020 1 #DARRAY (A1/1:7)
0030 INIT <‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’>
0040 END-DEFINE
0050 *
0060 INPUT USING MAP ‘HARR2’ #DARRAY (*)
0070 END

Now the Helproutine:

                                  > +  Helproutine HARR3    Lib XSTRO    

All …+…1…+…2…+…3…+…4…+…5…+…6…+…7…
0010 DEFINE DATA PARAMETER
0020 1 #VALUE (A1)
0030 1 #INDEX (I2)
0040 END-DEFINE
0050 *
0060 WRITE ‘IN HELPROUTINE, INDEX IS’ #INDEX
0070 END

Now two screen snaps from within the Map; first the .a screen

Name #DARRAY Top Dim 7__________ 1__________ 1__________

Dimensions Occurrences Starting from Spacing
1 . Index vertical 7__ 1__________ 0 Lines
0 . Index horizontal 1__ ___________ 1 Columns
0 . Index (h/v) V 1__ ___________ 0 Cls/Ls

001 --010—±—±—±–030—±—±—±–050—±—±—±–070—±—

                        .A                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  

Enter-PF1—PF2—PF3—PF4—PF5—PF6—PF7—PF8—PF9—PF10–PF11–PF12—
Help Mset Exit – - + < > Let

Now the .e screen

Arr #DARRAY Fmt A1

AD= MILT______ ZP= SG= HE= ‘HARR3’______________ Rls 0
AL= _____ CD= __ CV= ________________________________ Mod Data
PM= __ DF= DY= ______________________________
EM= __________________________ SB= ________________________________

001 --010—±—±—±–030—±—±—±–050—±—±—±–070—±—

                        .E                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  
                        :X                                                  

Enter-PF1—PF2—PF3—PF4—PF5—PF6—PF7—PF8—PF9—PF10–PF11–PF12—
HELP Mset Exit <— —> – - + < > Let

start from here and you should get it to work

steve

The problem with helproutines, I think, is the confusing documentation about explicit and implicit parameters. It reads:

And some lines later, it states:

Now is the question: does a helproutine have one or up to three or even up to four parameters? And, what is the sequence of the parameters?

When I interpret the docs correctly, the parameters of a helproutine must be ordered in this manner:

DEFINE DATA PARAMETER
1 explicit-parm1 (format) /* list of up to 20 explicit parameters
...(20)
1 field-value (format)    /* the value of the field where help was invoked for
/* if arrays are concerned:
1 index1 (I2) /* the index of the first dimension
1 index2 (I2) /* the index of the second dimension(if applicable)
1 index3 (I2) /* the index of the third dimension (if applicable)

A special explicit parameter is the field name. It must be of format (A65) (the maximum length a field name can have in Natural). To pass the field name as explicit parameter, you use the placeholder ‘=’ in the “HE”-parameter.

If you want to have access to any of the implicit parameters within the helproutine, the prior parameters must be mentioned, too. Thus you have to specify a parameter for field-value, if you want to have access to any of the indexes, and you have to specify the whole list of implicit parameters, if you want to have access to the third index index3. But you do not have to mention any of the indexes, if you are only interested in the field value.

Hello, i have a problem with help routine.
I have an array with 2 fiels in my map and i have to pass those fields to the helproutine.
It work with one field implicitly, but not with two fields.

I try to pass all fields explicitly
but how passing the index explicitly ?

Thanks for your answer.
Sorry for my english, i’m french.

Florian,

this is described in detail   here

Hth, best regards

   Wolfgang

my problem is that when I specify a field, the help routine no longer starts.
I have to explicitly specify all the fields I think.
how to send the index of the map to help routine?

Hi Florian;

I am not sure I understand the problem, so perhaps you could answer some questions:

  1. Is your data structure like (a) or (b)

    (a) 1 GROUP (10)
    2 #A (A3)
    2 #B (A3)

    (b) 1 #A (A3/1:10)
    1 #B (A3/1:10)

  2. In your INPUT statement (or Map), do you have one or two helproutines? For example:

    INPUT … #A () (HE=‘HELPA’…) // #B () (HE=‘HELPB’…)

or

   INPUT ...  #A (*) (HE='HELP'....)   // #B (*) (HE='HELP'....) 

or, do you have a map level help, for example:

  INPUT (HE='ONEHELP', #A (*) #B(*)) ....
  1. Do you want to distinguish both whether the user wanted help for #A or #B and which subscript, or do you just want to know which subscript?

  2. Are you aware that data entered into the two arrays on the map will NOT be transferred to the helproutine unless you do some special programming?

Finally, could you provide more information about what you are trying to accomplish.

steve

fields are defined in the style b) 1 #A (A3/1:10)

I have a single help routine.
It is defined in the fields of the map with the parameter HE.
Helproutine must react on my two fields on the screen
The field A gives the format.
The field B is the value depending on the format. The routine is help on the field B.

  1. see 2

  2. my help routine will be used to fill the field B by helping the user.

Hi Florian;

I am posting a program, map and helproutine. Hopefully I have understood your problem so the solution matches it.

As I understand it, you have two arrays, one is for output (the format) and one is for input (values that have the format shown in the other array).

Here is the code:

First the program:

                                  > +  Program     HHARR1   Lib XSTRO    

All …+…1…+…2…+…3…+…4…+…5…+…6…+…7…
0010 DEFINE DATA LOCAL
0020 1 #DARRAY (A1/1:7)
0030 INIT <‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’>
X 0040 1 #UVALUE (A10/1:7)
0050 1 #SEL (A10) /* not really needed but you might have some use for it.
0060 END-DEFINE
0070 *
0080 INPUT USING MAP 'HHARR2 ’
0090 #DARRAY() #UVALUE()
0100 END

Now the helproutine:

                                  > +  Helproutine HHARR3   Lib XSTRO    

All …+…1…+…2…+…3…+…4…+…5…+…6…+…7…
0010 DEFINE DATA PARAMETER
0020 1 #DARRAY (A1/1:7)
0030 1 #UVARRAY (A10/1:7)
0040 1 #VALUE (A10)
0050 1 #INDEX (I2)
0060 END-DEFINE
0070 *
0080 INPUT ‘IN HELPROUTINE, INDEX IS’ #INDEX (AD=O)
0090 // 'FORMAT FOR #DARRAY (#INDEX) IS ’ #DARRAY (#INDEX) (AD=O)
0100 // ‘INSERT VALUE FOR #UVARRAY (#INDEX) ==>’ #UVARRAY (#INDEX)
0110 *
0120 * INSERT VALIDATION CODE FOR ENTERED VALUE
0130 *
0140 MOVE #UVARRAY (#INDEX) TO #VALUE
0150 *
0160 END

I am assuming that if the user puts the question mark on say the third value spot, you will be showing them the third format, plus, perhaps, other info as well. The INPUT statement here is mainly just to show that the right field values are available.

Now the Map.

Ob _ Ob D CLS ATT DEL CLS ATT DEL
. . T D Blnk T I ?
. . A D _ A I )
. . A N ¬ M D &
. . M I : O D +
. . O I (
. .
001 --010—±—±—±–030—±—±—±–050—±—±—±–070—±—

          format info               value                                   
          -----------               ------                                  
                                                                            
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             

Enter-PF1—PF2—PF3—PF4—PF5—PF6—PF7—PF8—PF9—PF10–PF11–PF12—
Help Mset Exit Test Edit – - + Full < > Let

And here is a .e on the UVALUE array

Arr #UVALUE Fmt A10

AD= MILT______ ZP= SG= HE= +____________________ Rls 0
AL= ____ HELP PARAMETER EXTENSION
PM= __ HE= ‘HHARR3’,#DARRAY(),#UVALUE()________________________________
EM= ____ ______________________________________________________________

001 –

          format info               value                                   
          -----------               ------                                  
                                                                            
          (X                        .EXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             
          (X                        :XXXXXXXXXX                             

Enter-PF1—PF2—PF3—PF4—PF5—PF6—PF7—PF8—PF9—PF10–PF11–PF12—
HELP Mset Exit <— —> – - + < > Let

If you want the entered value separate from the array, I created #sel to hold that value

15:36:40 Field and Variable Definitions - Summary 2012-01-05

Cmd Field Name (Truncated) Mod Format Ar Ru Lin Col
___ #DARRAY_____________________________________ D A1 A 5 15
___ #UVALUE_____________________________________ D A10 A 5 41

                         LOCAL DATA DEFINITIONS                             

Cmd Name of Local Variable (Truncated) Format Ar
__ #SEL__________________________________________________ A10________



Let me know if this is what you are looking for.

steve

thanks
i will try as soon as possible