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
 

 

Two dimensional array error as 'Not enough subscripts'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Mon Mar 26, 2007 10:52 am    Post subject: Two dimensional array error as 'Not enough subscripts'
Reply with quote

How to define two dimensional array ?
I had written a program but it is not working properly.
Code:

IDENTIFICATION DIVISION.
PROGRAM-ID. EX40.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 N PIC 9 VALUE 1.
01 WS-COUNTRY.
     05 WS-COUNT-NAME OCCURS 3 TIMES.
           10 WS-COUNTRY-NAME PIC X(20).
           10 WS-STATE OCCURS 3 TIMES.
                 15 WS-STATE-NAME PIC X(20).
PROCEDURE DIVISION.
PARA-1.
          PERORM VARYING N FROM 1 BY 1 UNTIL N>3
           DISPLAY 'ENTER COUNTRY NAME:'
           ACCEPT  WS-COUNTRY-NAME (N)
           DISPLAY 'ENTER STATE NAME:'
           ACCEPT  WS-STATE-NAME (N)            ..............(18)
          END-PERFORM.
PARA-2.
          PERORM VARYING N FROM 1 BY 1 UNTIL N>3
           DISPLAY WS-COUNTRY-NAME (N)
           DISPLAY  WS-STATE-NAME (N)           ...............(24)
          END-PERFORM.
PARA-3.
          STOP RUN.


In the above program I want accept country names and state names one after the other 3 times. after that I am displaying the values. But when I compiled it it showing an error as 'Not enough subscripts. Assumed 1' for 18 and 24 lines. could you please correct it if I am wrong.
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Mar 26, 2007 11:01 am    Post subject:
Reply with quote

HI There,

Since WS-STATE-NAME is 2d array variable the u need to specify 2 subscript for this one is for WS-COUNT-NAME & another one is for
WS-STATE u have specify only one subscript thats why showing error
code should be
Code:

PARA-1.
          PERORM VARYING N FROM 1 BY 1 UNTIL N>3
              DISPLAY 'ENTER COUNTRY NAME:'
              ACCEPT  WS-COUNTRY-NAME (N)
              PERFROM VARYING M FROM 1 BY 1 UNTIL M>3
                  DISPLAY 'ENTER STATE NAME:'
                  ACCEPT  WS-STATE-NAME (N, M)            ..............(18)
              END-PERFORM
         END-PERFORM.
PARA-2.
          PERORM VARYING N FROM 1 BY 1 UNTIL N>3
             PERFROM VARYING M FROM 1 BY 1 UNTIL M>3
                 DISPLAY WS-COUNTRY-NAME (N)
                 DISPLAY  WS-STATE-NAME (N,M)           ...............(24)
             END-PERFORM
         END-PERFORM.
PARA-3.
          STOP RUN.


Hope it's clear now
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


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