Modified Option

Can anyone tell me if I can use the modified option on input using map?
The requirement I am trying to meet is, user is using update command on a screen even when they are only looking and not changing anything.
I know I can check every field against the database fieldsto see if any field was changed. I found the following sample in Natural for Mainframe Version 4.1.4

Define data local
1 #attr ©
1 #a (a1)
1 #b (a1)
end-define

move (AD=I) to #attr
*
input (cv=#attr) #a #b
if #attr modified
write notitle ‘field #a or #b has been modified’
end-if
*
end

When I tried to use the (cv=#attr) like so I get this error.

INPUT USING MAP ‘HA04110’ #MESSAGE +ACTION #PC-NO #GROUP
#SUBGROUP #DELETE #PROJECT #CNTLREF #DATEADD #PJST
#TYPEIMPR #COUNTY-CODE #COUNTY-END #DATESTRT-TP #DATESTRT-YR
#DC #DATEEND-TP #DATEEND-YR +CNT #PO
#PROFREF #T #INFFACT #SO #FEDSHARE #OTHER-SHARE
#ESTAMT #CCOAMT #TOTAL-AMT #TOTAL-HIST-AMT #AMT-REMAIN #NOMEN
(CV=#ATTR)

ERROR:
A parameter which is included for a constant input map or write map
without explicit parameter specification is invalid or undefined.

and if i try this:

INPUT (CV=#ATTR) USING MAP ‘HA04110’ #MESSAGE +ACTION #PC-NO #GROUP
#SUBGROUP #DELETE #PROJECT #CNTLREF #DATEADD #PJST
#TYPEIMPR #COUNTY-CODE #COUNTY-END #DATESTRT-TP #DATESTRT-YR
#DC #DATEEND-TP #DATEEND-YR +CNT #PO
#PROFREF #T #INFFACT #SO #FEDSHARE #OTHER-SHARE
#ESTAMT #CCOAMT #TOTAL-AMT #TOTAL-HIST-AMT #AMT-REMAIN #NOMEN

Error: If a DEFINE DATA statement is present, all variables/fields to be
used must be defined in the DEFINE DATA statement in an LDA, GDA
or PDA, which are referenced with the keyword USING in the
DEFINE DATA statement.
If this error occurs for a DDM and a DEFINE DATA statement is
present, a view of the DDM (and of any database field referenced
in the program) must be defined in the DEFINE DATA statement.

Any suggestions?
:frowning: :?:

Yes, you can use “modified” with maps. You need to add the control variable to each modifiable field on the map using the Natural map editor.

BTW, if your fields are named the same on your map as they are in your program, you should not need to list them in your input statement. You should be able to say:

INPUT USING MAP 'HA04110'

Problem is I’m modifing a program that has generic IFELD01 - IFELD032
names in the map. So I edit the map and put the cv on the map?

Not having direct experience with generic maps like this, I can’t say for sure, but it seems like it should work. I also noticed that you can add a map level control variable on the map settings page. That would be worth a try instead of putting it on each field. What I’m not sure is how you pass #ATTR to the map if you are explicitly passing the parameters.

Jerome,

Thanks for your help. I put the #attr on each updateable field and changed the input statement to:
INPUT USING MAP ‘HA04110’ #ATTR #MESSAGE +ACTION #PC-NO #GROUP
#SUBGROUP #DELETE #PROJECT #CNTLREF #DATEADD #PJST
#TYPEIMPR #COUNTY-CODE #COUNTY-END #DATESTRT-TP #DATESTRT-YR
#DC #DATEEND-TP #DATEEND-YR +CNT #PO
#PROFREF #T #INFFACT #SO #FEDSHARE #OTHER-SHARE
#ESTAMT #CCOAMT #TOTAL-AMT #TOTAL-HIST-AMT #AMT-REMAIN #NOMEN
:lol:

Just a couple of notes re this thread. Chuck, I am assuming you are new to Control Variables and the IF MODIFIED statement. If so, you should be aware of all the different ways to “go astray” with IF MODIFIED. In brief, if you have REINPUTs, it is possible to get “false” readings. That is, you will think a variable has been modified, when in reality it hasn’t, and, you will think a variable has not been modified, when it actually has (i imagine the latter would be more serious for your application).

Next, if a sufficiently large number of users are hitting the update PF Key, when they have not changed anything, it is high time (looks like your maps date to Natural Version 1) someone modified the text to tell them how to use the map properly.

Finally, although it may indeed be appropriate, it looks like database fields have been moved to corresponding user defined variables. While this may be appropriate for other processing, you should note it is not at all required to simple display a field on a Map.

steve