Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Brilliant! Your site is great...and saving me hours of time at work and making my boss think I am brilliant too! I also picked up on a thread that will potentially save us a lot of money in the future..."

Geography

Where in the world do Tek-Tips members come from?
thanuja77 (Programmer)
11 Dec 07 2:24
Hi guys,

I am getting protection execption (ASRA) in a Cobol-CICS program.See the piece of code given below

SET STATE-INDEX  TO +1.                              
SEARCH STATE-CODE-ENTRIES                            
    AT END                                           
          MOVE ZERO    TO STATE-CODE                 
                          ASSIGN-STATE-CODE          
    WHEN ASSIGN-STATE-CODE = STATE-CODE-ENTRIES      
                                  (STATE-INDEX)      
          SET STATE-CODE-NUM    TO  STATE-INDEX      
          MOVE STATE-CODE-NUM   TO ASSIGN-STATE-CODE,
                                          STATE-CODE.

The fields STATE-CODE and ASSIGN-STATE-CODE are both
alpha numerals.
when i move ZERO to ASSIGN-STATE-CODE only then its working fine.But fir STATE-CODE its not working.I mean the problem is with the field STATE-CODE.
Can anyone help me in this?

Glenn9999 (Programmer)
11 Dec 07 2:31
For what ASRA is, it indicates a problem with some of the data in the variables.  What are the data-types of the variables you showed and where do they come from (CICS screen, copy book, etc)?
thanuja77 (Programmer)
11 Dec 07 2:41
When i XPED, ASRA is showed at the line
            MOVE ZERO    TO STATE-CODE                 
                            ASSIGN-STATE-CODE  
The variables STATE-CODE and ASSIGN-STATE-CODE are defined as ALPHA NUMERICALS.
The variable STATE-CODE is in the copybook and ASSIGN-STATE-CODE comes from the CICS Screen.

I am sure that the exception is coming when ZERO is moved to STATE-CODE.But i couldnt find the reason and solution for this after a long analysis.

        
Glenn9999 (Programmer)
11 Dec 07 2:55
Okay, we need to think a little more broadly than just one line, etc.  As a rule, usually problems like ASRA surface more when the code depends on the data-type being right, etc.  For example, a space won't be a problem in numeric data until you try to do something with it (compare, compute, etc)

How is STATE-CODE-ENTRIES defined?  Alpha-numeric as well?
Have you tried displaying the contents of ASSIGN-STATE-CODE (to do that, SEND TEXT and then RETURN) before the search happens to make sure you're getting from the map what you think you are?  For that matter, how is the variable defined in the map?
Glenn9999 (Programmer)
11 Dec 07 3:11
Okay, I think I have an idea of a problem area.

CODE

SET STATE-CODE-NUM    TO  STATE-INDEX      

if STATE-CODE-NUM is alphanumeric as you say (this means PIC X something), then its typically an incompatible variable for a SET statement.  In fact, now that I thought about it, your compiler should be producing a warning over it, like mine did when I tried it.

Quote:


C:\BACKUP\TEST.CBL 12: JMN3343I-S  RECEIVING ITEM 'AVALUE' OF SET STATEMENT MUST BE INDEX-NAME,INDEX DATA ITEM,INTEGER ITEM,POINTER DATA ITEM OR ADDRESS OF SPECIAL REGISTER.

Try making STATE-CODE-NUM a numeric.
thanuja77 (Programmer)
11 Dec 07 3:52
Actually SPACES are passed to ASSIGN-STATE-CODE from the map and so while SEARCH it do not perform the WHEN statements and perform AT END statement.

Also the variable STATE-CODE-NUM is defined as numeric only.So there is no problem with SET statement.And that too here as WHEN condition fails it wont perform the statements
SET STATE-CODE-NUM    TO  STATE-INDEX      
          MOVE STATE-CODE-NUM   TO ASSIGN-STATE-CODE,
                                          STATE-CODE.

MarcLodge (Programmer)
12 Dec 07 19:35
thanuja77,
Please give the cobol PIC description of your fields. I believe they are as follows:
STATE-INDEX
STATE-CODE-ENTRIES
STATE-CODE
ASSIGN-STATE-CODE
STATE-CODE-NUM

Marc

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close