View previous topic :: View next topic
|
Author |
Message |
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Am designing a screen to get the input from the user, validate it and process further if the input is correct and display an error message if its wrong on the panels
Can anyone tell me how to pop up these error messages in panels?
Can you please let me know the correct use of ZMSG, LMSG, SMSG, Zedsmsg, Zedlmsg. I couldn't get the exact meaning of what are all these and how it is being used (an example it will be of great use).
Any help on these will be really greatful. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Code: |
zerrsm = "short message text"
zerrlm = "long message text"
Address ISPEXEC "SETMSG MSG(ISRZ002) " |
self explanatory isn' t it |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
Thanks for the reply
I would like to know how can these varibales can be used in actual programming and the real use of it.
For Example:
My panel is to get the input from the user validate it in rexx and trow the message accordingly
Say the panel is like this
Enter your Emp ID : _____________
say the user enters AAAAA
I need to validate in REXX and pop up a message saying
" Enter a valid Emp ID"
how can this be done. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
Little example for that:
Panel is dispayed. validation of a Dataset is done in the rexx.
If DSN does not exist, err-msg is set and panel is displayed again.
Dataset ...ISPF.MESSAGES is used for defining user-massages.
J120830.ISPF.MESSAGES(UMMSG03) :
UMMSG035 .ALARM=NO
'Dataset does not exist'
J120830.ISPF.CLIST(TVADL) :
ADDRESS ISPEXEC "ADDPOP"
UMPAN = "TVADL002"
UMCUR = "UDS1"
UMMSG = " "
DSNRC = 9
DO WHILE DSNRC > 0
ADDRESS ISPEXEC "DISPLAY PANEL ("UMPAN")
MSG ("UMMSG")
CURSOR ("UMCUR") "
DISPRC = RC
IF DISPRC > 0 THEN EXIT DISPRC
ADDRESS ISPEXEC "VGET (UDS1) PROFILE "
ADDRESS ISPEXEC "DSINFO DATASET('"UDS1"') "
DSNRC = RC
IF DSNRC > 0 THEN UMMSG = 'UMMSG035'
END
J120830.ISPF.PANELS(TVADL002) :
+ Please provide Dataset-Name
+
+ ...Ds-Name: +\z
+
)INIT
.ZVARS = '(UDS1)'
VGET (UDS1) PROFILE
)PROC
VER(&UDS1,NB,MSG=UMMSG037)
VPUT (UDS1) PROFILE
)END
Hope it helps, regards, UmeySan |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
Thank you so much for the reply.
I tried an example same like yours and created my own message and concatenated that message library with ISPMLIB
Code: |
/*REXX*/
UMPAN = "TY"
UMCUR = "INP"
UMMSG = " "
ADDRESS ISPEXEC "DISPLAY PANEL ("UMPAN")
MSG ("UMMSG")
CURSOR ("UMCUR")"
ADDRESS ISPEXEC
SAY RC
IF INP=100 THEN
UMMSG = 'MAL002'
|
Code: |
)ATTR
+ TYPE(TEXT) INTENS(HIGH)
\ TYPE(INPUT) INTENS(LOW)
)BODY EXPAND($$)
+ $-$
+
+ INPUT: +\Z
+
)INIT
.ZVARS = '(INP)'
)PROC
VER(&INP,NB,MSG=MAL002)
)END
|
Also i gave my input as 100 but then am not getting the error message
Please let me know if am doing something wrong. |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
Thanks everyone for all your help
I tried again and got it corrected the mistake was in the REXX
i didnt have the DO WHILE condition telling the REXX when it should be executed under what condition thats it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear that it is now working.
Thank you for posting the resolution
d |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi & namastē malathy_tv !
Nice to hear, that it works.
Nice to see a "UMPAN" variable in a piece of code in chennai / india !
Poi varukiren & Regards,
UmeySan |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi Gurus,
I have one more doubt
we are able to call the error message if we have check in the panels passing the message ID in it as follows
VER(&INP,NB,MSG=MAL001)
and then validitating and passing it again through REXX
but what if donot want to verify the input in the panels but validate and throw error message for the invalid input
how can this be achieved.
Thanks in advance |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
HI malathy_tv !
You don't really need the "VER(&INP,NB,MSG=MAL002)" in the panel
)PROC section, if you will do all validations in Rexx.
In my little example, as you could see, i used two different messages.
In the Panel, the input was only checked to be not blank, MSG037.
Then in Rexx, the entered DSN was checked against existence.
Here MSG035 was used if DSN not exists.
So this dat beed two separate & different validations.
Poi varukiren & Regards,
UmeySan |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi Umeysen,
Nandri ( Thank you )
i got your point what you said ....
i have one more thing i want to create my own error message, is that enough if i create the msglib ( a PDS) and concatenate with the ISPMLIB using the "ALLOC FA(ISPMLIB) DA(PDS.MSGLIB)" or do i have to any thing more as when i try executing this it says
message not found in 'ISPMLIB' library.
Current dialog statement:
DISPLAY PANEL (BFSP) MSG (MAL004)
Part of my REXX is:
DO WHILE STA > 0
ADDRESS ISPEXEC "DISPLAY PANEL ("UMPAN")
MSG ("UMMSG")"
...
P1 = SUBSTR(POL,1,2)
A = VERIFY(P1,XRANGE('A','Z'))
IF (A = 0 & B = 0) THEN STA=0
ELSE UMMSG = 'MAL004'
any idea.... |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
are you sure that the ALLOC command is working ?
Put trace on.
Gerry |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
I could see my MSGLIB getting concatenated with the ISPMLIB when i did the ALLOC i checked by doing ISRDDN
but still the error message says its not found... is there any other way that we can create our own messages.
Thanks. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I'm assuming you were able to see the member via ISRDDN ie. MEM MAL004
What does member MAL004 look like ?
Gerry |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
Its not a Member in the PDS it is like a msg id inside some member, this member is present in the PDS PDS.MSGLIB
and i was able to see the PDS PDS.MSGLIB using ISRDDN
EX:
MAL002 'INVALID OPTION'
MAL004 'INVALID STATE NUMBER' |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
MAL004 is not a member it is like the MSGID, it is present inside one of the member of the PDS.MSGLIB library
i was able to see only that the PDS.MSGLIB getting concatenated with the ISPMLIB using ISRDDN
Example of the MSGID present inside the member:
MAL002 'INVALID OPTION'
MAL004 'INVALID STATE NUMBER' |
|
Back to top |
|
|
malathy_tv
New User
Joined: 29 May 2007 Posts: 34 Location: chennai
|
|
|
|
Hi,
i found one method of populating the error message that is by using ZEDMSG
here am throwing the panels to get the input, validate in rexx and throw the error message
as UmeySan said i used this do while loop but when i do this am not able to check and validate both of my input on the same time
if either of these is correct it comes out without checking the other all this is because of using DO WHILE STA > 0 and setting the value to zero after every check but if i didnt do that am not getting the erro message as i said previously
/*REXX*/
STA = 9
DO WHILE STA > 0
ZEDSMSG = " "
ADDRESS ISPEXEC
"ADDPOP ROW(24) COLUMN(60)"
"DISPLAY PANEL ("PANEL")"
AGN_CHK:
A3 = VERIFY(AGN,XRANGE('0','9'))
IF A3 = 0 THEN STA=0
ELSE ZEDSMSG = 'INVALID AGENCY NUMBER'
"ISPEXEC SETMSG MSG(ISRZ001)"
RETURN
STE_CHK:
A4 = VERIFY(STE,XRANGE('A','Z'))
IF (A4 = 0 & LENGTH(STE) = 2 )THEN STA=0
ELSE ZEDSMSG = 'INVALID STATE CODE'
"ISPEXEC SETMSG MSG(ISRZ001)"
RETURN
so what can be done on this regards
Thanks in advance. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Regarding your program:
Code: |
/*REXX*/
STA = 9
DO WHILE STA > 0
ZEDSMSG = " "
ADDRESS ISPEXEC
"ADDPOP ROW(24) COLUMN(60)"
"DISPLAY PANEL ("PANEL")"
AGN_CHK:
A3 = VERIFY(AGN,XRANGE('0','9'))
IF A3 = 0 THEN STA=0
ELSE ZEDSMSG = 'INVALID AGENCY NUMBER'
"ISPEXEC SETMSG MSG(ISRZ001)"
RETURN
STE_CHK:
A4 = VERIFY(STE,XRANGE('A','Z'))
IF (A4 = 0 & LENGTH(STE) = 2 )THEN STA=0
ELSE ZEDSMSG = 'INVALID STATE CODE'
"ISPEXEC SETMSG MSG(ISRZ001)"
RETURN |
1. I think you need an END statement to match the DO WHILE
2. your panel name is a variable, but the name is not set anywhere
3. remove the RETURN statements. They will end the program, but I think you want to keep trying until no errors are found.
4. I do not think you should set STA=0 until both checks are ok. Currently, it will exit if one is ok, but not the other.
5. perhaps it got lost here in the forum, but you should indent nested lines
6. the ELSE will only perform one statement. you need to enclose your ZEDSMSG and the SETMSG within a DO / END clause.
7. move ADDPOP outside of loop.
8. good practice to have REMPOP after your ADDPOP
9. on your DO WHILE, good practice to enclose the condition within parenthesis.
10. check return code from DISPLAY. user might have cancelled panel, in which case you should exit and not perform any field checking.
11. surprised if "DISPLAY PANEL (" works. there should not be a space there.
12. I do not think you need the labels (AGN_CHK, STE_CHK)
13. I think your short messages should be in mixed case. |
|
Back to top |
|
|
|