Never mind, I figured it out.

In the first example, the last panel variable referenced by a panel definition 
statement is &DD in:

   IF (&DD = 29)

It is not counting &yyyy or &dd in:

      &stddate = '&yyyy/02/&dd'

because it is an assignment of a /literal/. The literal contains substitution 
values, but apparently the substitution doesn't count as a reference.


In the second example, I lied. The actual code was:

IF (&CMM = FEB)
 VER (&CD,RANGE,01,29)
 IF (&CD = 29)
    VER (&CYYY,nonblank,MSG=ASM003)
    &stddate = '&cyyy/02/&cd'
    ver (&stddate,stddate,msg=asm000)

So in this case, the last reference is the &CYYY in the VER.

The reason for this difference in the code is that in the first panel, previous 
code has guaranteed that there something in the year field. In the second 
panel, the year isn't required until it gets to the leap-day edit, so it must 
do an additional VER.


I thought I had tested and determined that the VER wasn't contributing to the 
code, but forgot that my ISPF session had timed out, and thus lost the Dialog 
Test disabling of the panel cache.


-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Schmitt, Michael
Sent: Thursday, October 23, 2025 3:20 PM
To: [email protected]
Subject: ISPF panel mystery: cursor position on last referenced field

In ISPF, "the cursor is automatically placed at the beginning of the field that 
was last referred to in any panel definition statement when a message is 
displayed because of a verification failure that sets .MSG".

I have a panel that contains fields DD, MMM, and YYYY. It contains this date 
verification code:

IF (&MMM = FEB)
   VER (&DD,RANGE,01,29)
   IF (&DD = 29)
      &stddate = '&yyyy/02/&dd'
      ver (&stddate,stddate,msg=asm000)

This works as expected. If the user enters 29 FEB 2025, it sets the cursor to 
the day field (29) and sets an error message.


But I have another panel that contains similar fields CD, CMM, CYYY. It 
contains this code:

IF (&CMM = FEB)
 VER (&CD,RANGE,01,29)
 IF (&CD = 29)
    &stddate = '&cyyy/02/&cd'
    ver (&stddate,stddate,msg=asm000)

This code is setting the cursor to the CYYY field, not CD as expected.

I don't get it. In both cases the last panel field referenced is in the 
assignment statement. I see know reason why the panels would behave differently.

Sure, I can force it by adding a dummy assignment, but I'm wondering why the 
different behavior.


___________________________________________________
Michael Schmitt | DXC Apps Development | MassMutual
(737) 910-8248 | [email protected]

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to