Combine Multiple Inputs with Parameters and Set Control Knn

Hi,

I’ve a problem when trying to combine multiple INPUTS and filling MAP Parameters.

For example:

[b]PGM 1

SET KEY ALL
INPUT USING MAP ‘MAP1’ /* Collecting Data (with 4 parameters)
IF PF-KEY = ‘PF3’
INPUT USING MAP ‘MAP2’ /
Data Confirmation (with 1 parameter)
IF *PF-KEY = ‘ENTR’ AND OPTION = ‘S’
STORE DB
END-IF
END-IF
[/b]

[b]SPGM 1

SET KEY ALL
MOVE “S;” TO PARMS-MAP2
STACK TOP DATA PARMS-MAP2
SET CONTROL ‘K00’ /* PF-KEY Assign for MAP2
MOVE “A;1;3;G;” TO PARMS-MAP1
STACK TOP DATA PARMS-MAP1
SET CONTROL ‘K03’ /* PF-KEY Assign for MAP1
FETCH RETURN ‘PGM1’
END TRANSACTION
[/b]

Doing this, the pf-key that is returns from MAP2 is not ‘ENTR’ botk ‘PF3’.

So the question is:

“How to ‘force’ the activation of subsquent PF-KEY’s for subsquent MAPS ?”
or
“How to put multiple PF-KEY assigments/activations on a STACK DATA ?”

Is there some code you have not shown us? This works fine on my system.

steve

Hi Steve,

For a better example, I attach a zip file with all the objects used plus one (see attach comment)

I’m able for any more question
AllObjectsUsed.zip (12 KB)

Sorry, I should have read your problem more closely the first time.

You cannot do what you are trying to do in the manner you have coded.

SET CONTROL ‘K03’ does not put anything on the Stack. It looks like you think it does.

try the following:

SPGM 1

SET KEY ALL
MOVE “S;” TO PARMS-MAP2
STACK TOP DATA PARMS-MAP2
SET CONTROL ‘K04’ /* PF-KEY Assign for MAP2 note change
write pf-key
MOVE “A;1;3;G;” TO PARMS-MAP1
STACK TOP DATA PARMS-MAP1
SET CONTROL ‘K03’ /
PF-KEY Assign for MAP1
write *pf-key
FETCH RETURN ‘PGM1’
END TRANSACTION

running this program should show you why *PF-key was PF3 for both maps.

The code you sent is very convoluted. You should probably redesign what you are doing.

Side note to the code you sent:

FOR #I = ECRS TO 1 STEP -1
0190 MOVE EDITED #PF(#I) (EM=99) TO #PFA
0200 COMPRESS ‘K’ #PFA INTO #CMD LEAVING NO
0210 STACK TOP DATA #DAD(#I)
0220 SET CONTROL #CMD
0230 END-FOR

COMPRESS works with numeric operands. It is inefficient, and silly, to to do the MOVE EDITED; just COMPRESS ‘K’ #PF(I); but that is not what you need anyway.

steve

Hi Steve,

My main question is:

“How can I “assign/activate” a PF-KEY for MAP1 and a new PF-KEY for MAP2 from the caller?”

This is possible?

We are trying to reuse the existing code for Mainframe, in new webservices, and with the existing code we have this “question”.

Having 2 Maps / Data Input for both maps:
For 1st Map my exit is with a ‘PF3’
For 2nd Map my exit is with ‘PF12’
means:
INPUT (STACKED DATA 1) + ‘PF3’
INPUT (STACKED DATA 2) + ‘PF12’

PS: That “MOVE EDITED” was mainly to be sure that the value ‘K3’ or ‘K03’ it has the same meaning. (Thanks for the observation).

Ah, the old “fix it, but don’t change very much” mess. Know it well. I guess the easiest way to do this would be to pass the PF key names in the FETCH RETURN, something like:

PGM 1

INPUT #FIRST-MAP-KEY #SECOND-MAP-KEY /* new code


SET KEY ALL


IF #FIRST-MAP-KEY NE ’ ’
SET CONTROL #FIRST-MAP-KEY /* new code
END-IF


INPUT USING MAP ‘MAP1’ /* Collecting Data (with 4 parameters)
IF *PF-KEY = ‘PF3’


IF #SECOND-MAP-KEY NE ’ ’
SET CONTROL #SECOND-MAP-KEY /* new code
END-IF


INPUT USING MAP ‘MAP2’ /* Data Confirmation (with 1 parameter)
IF *PF-KEY = ‘ENTR’ AND OPTION = ‘S’
STORE DB
END-IF
END-IF

SPGM 1

SET KEY ALL
MOVE “S;” TO PARMS-MAP2
STACK TOP DATA PARMS-MAP2


MOVE ‘K00’ TO #SECOND-MAP-KEY /* PF-KEY Assign for MAP2 new statement


MOVE “A;1;3;G;” TO PARMS-MAP1
STACK TOP DATA PARMS-MAP1


MOVE ‘K03’ TO #FIRST-MAP-KEY /* PF-KEY Assign for MAP1 new statement


FETCH RETURN ‘PGM1’ #FIRST-MAP-KEY #SECOND-MAP-KEY
END TRANSACTION

this should work, and will likely not foul up too much code, unless there are many programs which might be doing the FETCH RETURN.

steve