Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Do Not Allow User to enter junk character

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Mon Sep 29, 2014 6:09 pm    Post subject: Do Not Allow User to enter junk character
Reply with quote

Hi,

At our CICS shop, for one of the input field on CICS screen - we are getting junk or invalid characters. This is causing the junk characters getting transferred to target database and further onto all related files.

If i want to stop the user from entering the junk characters on screen, what are the ways to do so ?

Note - The field is ALPHANUMERIC / X(40) general comment field.

Can we put a logic in code to validate that field character by charcter for not JUNKS ?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Mon Sep 29, 2014 6:43 pm    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Well, you'll have to define what "JUNKS" means to your application.

You may want to wonder how a user can enter "junk", since they only have a keyboard. Everything they can type from there is perfectly ordinary non-junk stuff.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon Sep 29, 2014 6:46 pm    Post subject:
Reply with quote

Bill,

What if the user is a politician? :-)
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Sep 29, 2014 8:42 pm    Post subject:
Reply with quote

Quote:
What if the user is a politician? :-)
icon_lol.gif

They must be banned. icon_lol.gif

Rohan, Do you mean junk as a special characters apart from A-Z or 0-9 (btw they are no junk though)? if so then look at the below few links ( which you could have googled it as well) that would help.

http://ibmmainframes.com/about58120.html
http://www.ibmmainframes.com/about28691.html
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Sep 30, 2014 11:41 am    Post subject:
Reply with quote

vasanthz wrote:
Bill,

What if the user is a politician? :-)
Politician with a keyboard, a rare sight!? icon_smile.gif
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Wed Oct 01, 2014 11:01 am    Post subject:
Reply with quote

icon_smile.gif icon_smile.gif ha ha..

Thanks guys.. junk means definitely non readable invalid characters apart from special characters and regular alphabets and numerics.

I also wonder how junks can be entered in CICS screen.. icon_sad.gif

I see table is getting these junk data from one of the program related to CICS screen and still investigating if there is any issue in between data passed through COMMAREA or somewhere else.

I could see such junks getting transmitted for only one particular user of the application so thinking of all possiblities on what special things he would have done icon_eek.gif icon_eek.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Wed Oct 01, 2014 11:32 am    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Well, the corruption is being done by the program (somehow). That particular user is doing something different, using the system differently, and that happens to give you the problem.

Depending on complexity (of task) and availability (of user) finding out what they do differently may help you find the problem.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Oct 01, 2014 6:27 pm    Post subject:
Reply with quote

Quote:
Can we put a logic in code to validate that field character by charcter for not JUNKS ?


Ofcourse,Yes you need to do that and you need to throw an error to front end for any "non-readable data" and the rest should pass through

So that should be the logic
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Oct 01, 2014 8:34 pm    Post subject:
Reply with quote

see as well, if you are initializing fields properly.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Wed Oct 01, 2014 8:59 pm    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Guys, a little thought here.

You have a CICS or IMS/DC data-entry screen. Go to one of those. Locate a transaction which has numeric fields. Try typing your name into that field. Didn't work?

Go to a "text" field. Try getting non-keyboard characters into that, whilst sitting at the terminal. Any luck?

If "junk", as in non-display characters, is getting into a field, there is program problem. Perhaps a subtle difference between what fields are displayed for input, and what are received for input. Perhaps something worse. But it is a programming problem.

If there is a mix of non-junk/junk, then what is the mix? Junk at the end of the field, at the beginning, scattered in a pattern throughout, scattered randomly throughout? What? (those are in order of my estimation of likelihood).

How is initialising a field going to help? It receives data, splattering whatever was there before, whether initlialised or not.

You have a program problem, not a keyboard problem, not a user problem. A program problem. You need to identify what the problem is before you try to fix it. If you start just throwing fixes, you may cover a symptom and not get the problem, until it bites you later.

Don't go validating billions of characters just for the heck of it. Non-text is appearing where it shouldn't, and it is not coming from the "screen".

One thing you can do is: sit two users side-by-side; one is the one who gets the problem; the other is another user who uses the same transaction; get the first user to do their work; watch the face of the other user - when they look surprised, you're starting to home in on it.

Otherwise or at the same time, look at the data which is affected, look at data which is not affected. Look at the program. Look at the data. Look at the program. Look at the data. Look for patterns, repeats, anything recognisable (things which may be packed numbers, things which may be binary counts, things which are a bit of text which is a recognisable indicator of something in the system).

Come up ONLY WITH PLAUSABLE possibilities. They must fit all the known facts, or must explain how something has changed to become the known fact.

Do not, do not, do not, just bang changes into the program which you cannot directly and consciously link to the problem.

If you add diagnostics of some type, be careful to check that the results don't change just from adding that code.

Also, how long has this been happening? When was the program last changed? When did that user start working on the project?

If you are going to change something, ask yourself "how will this affect the problem"? If you can't get a direct answer for that, you are pushing water uphill, and maybe washing away something useful at the same time.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Oct 01, 2014 10:59 pm    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Code:

           03  WS-XLATE-TBL-REC.                                       
               05  WS-XLATE-TBL    OCCURS 256 TIMES                     
                                   INDEXED BY X-WS-XT, X-WS-XT-MAX     
                                   PIC  X(001). 
           03  WS-WORK-AREA        PIC  X(079).
           03  WS-BYTE             PIC  X(001).                     
           03  WS-SUB              PIC  9(008)     BINARY.             
           03  WS-SUB-X            REDEFINES WS-SUB                     
                                   PIC  X(004).                         
           03  WS-FWORD            PIC  9(008)     BINARY.             
           03  WS-FWORD-X          REDEFINES WS-FWORD                   
                                   PIC  X(004).
           03  WS-INDEX            PIC  9(008)     BINARY.
           03  WS-INDEX-X          REDEFINES WS-INDEX
                                   PIC  X(004).                       
      *                                                                 
      **** BUILD 'WS-XLATE-TBL' WITH CHARACTERS X'00' THRU X'FF'       
      *                                                                 
           COMPUTE WS-FWORD        = (LENGTH OF WS-XLATE-TBL-REC /     
                                      LENGTH OF WS-XLATE-TBL (1)).
           SET  X-WS-XT-MAX        TO WS-FWORD.                         
           SET  X-WS-XT            TO 1.                               
      *                                                                 
           PERFORM UNTIL X-WS-XT > X-WS-XT-MAX                         
               SET  WS-SUB         TO X-WS-XT                           
               SUBTRACT 1          FROM WS-SUB                         
               MOVE WS-SUB-X (4:)  TO WS-XLATE-TBL (X-WS-XT)           
               SET  X-WS-XT        UP BY 1                             
           END-PERFORM.                                                 
 

Now, you've built a TRANSLATE-TABLE, but it needs further scrutiny. Get out your YELLOW-CARD and determine what bytes of the TRANSLATE-TABLE are legitimate and what aren't. For example, a '%' might be considered "JUNK". So, clear WS-SUB to ZERO, move '%' to WS-SUB-X (4:), set X-WS-XT to WS-SUB and move X'FF' (or whatever you desire), to WS-XLATE-TABLE (X-WS-XT + 1).

Then, issue an in-line PERFORM targeting the desired map-field. During the perform, if the 'n'th byte of the map-field is found to equal X'FF', then the field needs to be fixed and send a message to the operator, indicating the byte-position found in WS-SUB of the map-field contains an unacceptable character.

This should give you a better idea and get you on your way.

Good luck, we're all counting on you....

Code:

           MOVE WS-MAP-FIELD (1:)      TO WS-WORK-AREA (1:).                             
           MOVE 1                      TO WS-FWORD.                                                                                   
           MOVE ZERO                   TO TALLY.
       *                                                                                       
           PERFORM UNTIL WS-FWORD > LENGTH OF WS-MAP-FIELD             
               MOVE WS-FWORD           TO WS-SUB                       
               MOVE WS-WORK-AREA (WS-SUB:1)                             
                                       TO WS-BYTE                       
               MOVE ZERO               TO WS-INDEX                     
               MOVE WS-BYTE            TO WS-INDEX-X (4:)               
               SET  X-WS-XT            TO WS-INDEX                     
               IF  WS-BYTE NOT = WS-XLTE-TBL (X-WS-XT + 1)             
                   MOVE LENGTH OF WS-MAP-FIELD                         
                                       TO WS-FWORD                     
                   MOVE WS-SUB         TO TALLY                         
               END-IF                                                                       
               ADD  1                  TO WS-FWORD                     
           END-PERFORM.                                                 

If after the PERFORM, the TALLY Special-Register is non-zero, then this represents the MAP-FIELD position which contains invalid data.

If TALLY = ZERO, then you're good to go....
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Oct 01, 2014 11:38 pm    Post subject:
Reply with quote

you also have the use of the COBOL SPECIAL-NAMES.
Code:
CLASS ALPHA-SPECIAL IS 'A' THRU 'J', '_',
                       'K', 'L', 'M', 'N', 'O', 'P', 'Q',
                       'R', 'S', 'T', 'U', 'V', 'W', 'X',
                       'Y', 'Z', '0', '1', '2', '3', '4',
                       '5', '6', '7', '8', '9', ' ', '*',
                       ',', '/', '$', '&', '(', ')', ';',
                       '-', '%', '?', '@', '#', '.', ':'.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Oct 02, 2014 12:32 am    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Mickey,

Yup, that's a whole lot easier....

Regards,
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Oct 02, 2014 1:45 am    Post subject:
Reply with quote

Bill O'Boyle, Exactly I supplied these links earlier but TS says the bad data is out of what Mickeydusaor and Me suggested.

Bill, I meant if he has some junk in the database then that could be by because of . 1. Bad data from the screen itself 2. correct data from the screen but somehow in the program the data gets changed to bad data and for such change, one of the reason could be of NOT initialization.

However, I concur with all of your explaination to basically put a pause at the source of the data itself before even it gets processed.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Oct 02, 2014 6:10 am    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Rohit - Sorry for the duplication.... icon_redface.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Oct 02, 2014 7:10 am    Post subject:
Reply with quote

Oh.. Bill please do not say so. You have so much of knowledge that I and many other here try everyday to get as much as we can , so thank you to you.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Oct 02, 2014 8:36 pm    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Rohit,

I look at it this way. We are all colleagues on this forum and we help others when we can. Sometimes it's a struggle, whereas other times, the response from the poster (if sent) is the ever popular venacular "Oh Sh*t". icon_smile.gif

I've learned a lot from others and I hope some of my "Geekiness" has been worthwhile. icon_wink.gif

Regards,
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Oct 02, 2014 8:52 pm    Post subject: Reply to: Do Not Allow User to enter junk character
Reply with quote

Mr Bill, I'm pleased to say that I've had benefits from your posts. I'm sure I'll get more in the future.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Oct 02, 2014 10:07 pm    Post subject:
Reply with quote

As I have over the years along with some of his code he has sent to me.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Fri Oct 03, 2014 3:20 am    Post subject:
Reply with quote

Quote:
I've learned a lot from others and I hope some of my "Geekiness" has been worthwhile


Of course very much, because whatever I could be able to do today ( I'm sure other(s) too like me) has most of the contribution from this forum and eventually it will drill down to you (*ALL) experts.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts SORT - E15 and E35 using same user ex... Abhi Nature DFSORT/ICETOOL 12 Mon Oct 03, 2016 4:33 pm
No new posts Continuation Character ballaswaroop SYNCSORT 8 Thu Aug 25, 2016 4:46 pm
No new posts User exit in COBOL programs ganasrinivasan PL/I & Assembler 0 Thu Aug 18, 2016 12:48 pm
No new posts Creating an 'Enter' event with IMS MF... dileep chirasani Java & MQSeries 1 Sat Aug 06, 2016 2:23 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us