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
 

 

INPUT-INDEX Syntax Error IGYPA3074-S

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

New User


Joined: 13 Oct 2007
Posts: 19
Location: Fort Worth, Tx USA

PostPosted: Tue Nov 23, 2010 7:37 am    Post subject: INPUT-INDEX Syntax Error IGYPA3074-S
Reply with quote

What is wrong with this?

The error message is:
"INPUT-INDEX (INDEX NAME)" WAS NOT NUMERIC, BUT WAS A SENDER IN AN ARITHMETIC EXPRESSION. THE STATEMENT WAS DISCARDED."

The variables are:
Code:
01  INPUT-RECORD.                                     
    05  INPUT-CHAR              OCCURS 80 TIMES       
                                INDEXED BY INPUT-INDEX
                                PIC X(01).           
01  FILLER                      REDEFINES INPUT-RECORD
                                PIC X(01).           
    88  INPUT-RECORD-IS-A-COMMENT          VALUE '*'.     



The statement where the error occurs is:
Code:
SEARCH INPUT-CHAR                                         
       AT END MOVE LIT-1 TO LIT-1                         
       WHEN INPUT-CHAR (INPUT-INDEX) = 'A'                 
       AND  INPUT-CHAR (INPUT-INDEX + 1) = 'P'             
       AND  INPUT-CHAR (INPUT-INDEX+2) = 'P'               
       AND  INPUT-CHAR (INPUT-INDEX+3) = 'L'               
       AND  INPUT-CHAR (INPUT-INDEX+4) = 'C'               
       AND  INPUT-CHAR (INPUT-INDEX+5) = 'T'               
       AND  INPUT-CHAR (INPUT-INDEX+6) = 'N'               
       AND  INPUT-CHAR (INPUT-INDEX+7) = ' '               
       AND  INPUT-INDEX + 7 < 72                           
            PERFORM ..... etc etc etc
The error points to here:
WHEN INPUT-CHAR (INPUT-INDEX) = 'A'

I do not see "it"???
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 23, 2010 9:10 am    Post subject:
Reply with quote

Hello,

Suggest you learn how to use the "Code" tag - this will preserve alignment and improve readability. Your post has been "Code'd".

Change this:
Code:
01  INPUT-RECORD.                                     
    05  INPUT-CHAR              OCCURS 80 TIMES       
                                INDEXED BY INPUT-INDEX
                                PIC X(01).   
to this:
Code:
01  INPUT-RECORD.                                     
    05  INPUT-CHAR              OCCURS 80 TIMES       
                                INDEXED BY INPUT-INDEX.
        10 MYCHAR               PIC X(01).   
Back to top
View user's profile Send private message
luis_pr

New User


Joined: 13 Oct 2007
Posts: 19
Location: Fort Worth, Tx USA

PostPosted: Wed Nov 24, 2010 3:48 am    Post subject: Reply to: INPUT-INDEX Syntax Error IGYPA3074-S
Reply with quote

Thanks for the info, dick scherrer. By the way, the source code changes that you mention... from the "change this" section to the "to this" section.... were they meant to suggest that they would correct my problem? It did not look to me as if they would but I tried and still had same the error.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Nov 24, 2010 3:58 am    Post subject: Re: INPUT-INDEX Syntax Error IGYPA3074-S
Reply with quote

luis_pr wrote:
What is wrong with this?

AND INPUT-INDEX + 7 < 72


INPUT-INDEX is an index and you can not add to it, you could use
Code:
and input-index < 65
for the same results.
Back to top
View user's profile Send private message
luis_pr

New User


Joined: 13 Oct 2007
Posts: 19
Location: Fort Worth, Tx USA

PostPosted: Wed Nov 24, 2010 4:13 am    Post subject: Reply to: INPUT-INDEX Syntax Error IGYPA3074-S
Reply with quote

OMG, Craq Giegerich. Yes, that was it but for some reason the compiler generated the error message against all the lines in the WHEN Statement instead of just against that one condition. Ooooh, weeeeell. Thanks and Happy Thanksgiving everyone!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 24, 2010 4:18 am    Post subject:
Reply with quote

Hello,

I knew i should have waited until i could actually test this before posting icon_redface.gif

This much compiles clean (using your original code).
Code:
           SEARCH INPUT-CHAR                                           
              AT END DISPLAY 'END'                                     
              WHEN INPUT-CHAR (INPUT-INDEX) = 'A'                       
                     AND  INPUT-CHAR (INPUT-INDEX + 1) = 'P'           
                   DISPLAY 'A'.                                                           


This generates the error:
Code:
           SEARCH INPUT-CHAR                                   
              AT END DISPLAY 'END'                             
              WHEN INPUT-CHAR (INPUT-INDEX) = 'A'               
                     AND  INPUT-CHAR (INPUT-INDEX + 1) = 'P'   
                     AND  INPUT-INDEX + 7 < 72                   
                   DISPLAY 'AP'.         

34 IGYPA3074-S "INPUT-INDEX (INDEX NAME)" was not numeric, etc...

Which makes sense now that i look at it closer. . . The expression can be used as the index, but not as it is used in this statement.
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 Nov 24, 2010 2:27 pm    Post subject: Reply to: INPUT-INDEX Syntax Error IGYPA3074-S
Reply with quote

Alternative to hard-coded max test, providing that INPUT-INDEX must be less than the maximum-array occurs, minus 15 -

Code:

03  WS-MAX-SUB PIC 9(08) COMP.
03  WS=FWORD PIC 9(08) COMP.
03  WS-MAX-INDEX INDEX.

DIVIDE LENGTH OF INPUT-RECORD BY LENGTH OF INPUT-CHAR (1) GIVING WS-MAX-SUB.
SUBTRACT 15 FROM WS-MAX-SUB GIVING WS-FWORD.
SET  INPUT-INDEX TO WS-FWORD.
SET  WS-MAX-INDEX TO INPUT-INDEX.
SET  INPUT-INDEX TO 1.

Then, substitute -

Code:

and input-index < 65

with -

Code:

and input-index < ws-max-index

Bill
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 Need help with below DB2 error ashek15 DB2 3 Sat Mar 18, 2017 5:56 am
No new posts FINDREP Syntax Error seahawk789 DFSORT/ICETOOL 4 Thu Mar 09, 2017 10:11 pm
No new posts INVOKE WEBSERVICE error danik56 CICS 11 Thu Mar 09, 2017 11:52 am
No new posts Row not found Sql error GaganGarg DB2 7 Tue Mar 07, 2017 6:29 am
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am


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