IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to skip Special Charaters on a CICS Screen?


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
santoshkumarmanilakkoju

New User


Joined: 24 Nov 2009
Posts: 37
Location: Don't know

PostPosted: Mon Oct 01, 2012 4:57 pm
Reply with quote

Hi, I have requirement to populate a Error messae when user enters data on CICS Screen. Filed is defined as Alphanumeric and length of 3 bytes.

Conditions-
1) User cannot enter Special charaters;
2) User can enter data which is not case sensitive;
3) User cannot enter few specific codes;

Code:
IF FIELD-L = 0                             
   IF FIELD-A = EOF-KEY                     
      NEXT SENTENCE                                     
   END-IF                                               
ELSE                                                     
   IF FIELD-L > 0                           
      IF FIELD = 'CCL' OR 'NET' OR         
                     'ACC' OR 'OIU' OR 'PIE' OR 'OTH'   
         MOVE 'A'    TO LS-ERROR-TYPE                   
         MOVE 'A'  TO FIELD-A
         MOVE -1  TO FIELD-L               
      ELSE                                               
         MOVE FIELD                         
           TO FIELD2
         MOVE 'Y'    TO TRAILER-X
         MOVE 'A'  TO FIELD-A
      END-IF                                             
ELSE                                                     
    NEXT SENTENCE                                       
   END-IF                                               
END-IF.


Is there a way to handle Special characters in the ELSE part?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 01, 2012 5:30 pm
Reply with quote

This is an excellent example for implementation of the EVALUATE Statement.

Do that and your problem is solved.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 01, 2012 5:32 pm
Reply with quote

Yes.

Firstly, don't use NEXT SENTENCE. Replace with CONTINUE. This won't help with your requirement, but will help if someone ever removes the fullstop/period on your final END-IF. This also applies to any IF you or anyone at your site or anyone anywhere has ever coded.

Since the advent of Cobol II, around about the end of the Cretaceous Period, NEXT SENTENCE is nothing but "an accident waiting to happen". Not bothering with fullstops/periods at all except to precede a procedure-name, END-PROGRAM, end of the program and to end the PROCEDURE DIVISION statement might take longer to sink in, but it'll only help in the "long run" (I mean for coding future, not for execution times of steps).

Why don't you use an 88 on FIELDD? Can be made a descriptive name and makes the code much tidier and easier to maintain (as it has a name).

Why is FIELDD, and for that matter FIELDD2, called that? Can't it be something more descriptive? Helps to understand/maintain the program and reduces stupid coding errors.

To your requirement, how about telling is what is "valid" in the field, rather than that you want to reject something called "special characters" which only means whatever any person says at any given time?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 01, 2012 5:56 pm
Reply with quote

silly of me to preach without practicing:

Code:
EVALUATE TRUE
    WHEN FIELD-L < 1
         PERFORM NO-DATA-ROUTINE
    WHEN FIELD-IS-A-K-L-R-S-Z-0-9
         CONTINUE

(As Bill says, make these 88's  = 'CCL' OR 'NET' OR 'ACC' OR 'OIU' OR 'PIE' OR 'OTH'
    WHEN FIELD-IS-CLASS1 
         MOVE 'A' TO LS-ERROR-TYPE                   
         MOVE 'A' TO FIELD-A
         MOVE -1  TO FIELD-L               
    WHEN ......
END-EVALUATE

2 WHEN's (compares) and acceptable data is moving on in the program.
the remaining WHEN's isolate individual error conditions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts How to avoid duplicating a CICS Web S... CICS 0
Search our Forums:

Back to Top