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

Compiler error IGYPS2120-S Expected a reference-modification


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Fri Dec 27, 2013 6:57 pm
Reply with quote

Hi,

I am trying to compile a Cobol Db2 code which looks like below:

Cursor TST_CSR is declared as below:

Code:
EXEC SQL                                 
   DECLARE TST_CSR CURSOR                 
           WITH ROWSET POSITIONING  FOR   
   SELECT SEC_NO                       
     FROM TABSEC                       
    WHERE TYPE_CD = 'CAD'               
   FOR READ ONLY WITH UR                 
END-EXEC.       


Above cursor TST_CSR is fetched as below:

Code:
EXEC SQL                                 
    FETCH NEXT ROWSET FROM               
       TST_CSR                           
            FOR 10 ROWS     
      INTO :WS-SEC-NO                   
END-EXEC.         


Working Storage variable WS-SEC-NO is declared as below:
Code:

01  WS-CURSOR_DATA-HD.                                     
    05  WS-SEC-NO              PIC X(5) OCCURS 3000 TIMES.


Now, while compiling my program I got below error message:

IGYPS2120-S Expected a reference-modification specification but found ")". The "CALL" statement was discarded.

Code:
PROCEDURE DIVISION.                                              03650
                                                                 03730
DSNSQL SECTION.                                                       
SQL-SKIP.                                                             
    GO TO SQL-INIT-END.                                               
SQL-INITIAL.                                                         
    MOVE 1 TO SQL-INIT-FLAG.                                         
    CALL 'DSNHADDR' USING SQL-CODEPTR OF SQL-PLIST3 SQLCA.           
    CALL 'DSNHADDR' USING SQL-VPARMPTR OF SQL-PLIST4 SQL-PVAR-LIS     
    T4.                                                               
    CALL 'DSNHADD2' USING SQL-PVAR-ADDRS3 IN                         
    SQL-PVAR-LIST4 WS-ROWSET-SIZE SQL-NULL                           
    CALL 'DSNHADDR' USING SQL-APARMPTR OF SQL-PLIST4 SQL-AVAR-LIS     
    T4.                                                               
    CALL 'DSNHADD2' USING SQL-AVAR-ADDRS1 IN                         
    SQL-AVAR-LIST4(1) SQL-NULL.                                       

IGYPS2120-S Expected a reference-modification specification but found ")".  The  "CALL" statement was discarded. 

    CALL 'DSNHADDR' USING SQL-CODEPTR OF SQL-PLIST5 SQLCA.   
SQL-INIT-END.                                               
    CONTINUE.         


Please help me to resolve this error.

Thanks.

Code'd
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: Fri Dec 27, 2013 7:14 pm
Reply with quote

Is the cunningly-named SQL-AVAR-LIST4 part of an OCCURS? No. It's not. So when the compiler sees an opening bracket, it knows it can only be a reference-modification, and with that message the compiler is expressing its disappointment that no valid reference modification was found.
Back to top
View user's profile Send private message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Sat Dec 28, 2013 2:09 pm
Reply with quote

SQL-AVAR-LIST4 is automatically generated while I am trying to compile my code.

Please let me know what is wrong in my code for which I got above compiling error and how to solve it.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sun Dec 29, 2013 10:17 pm
Reply with quote

Were there any warning messages produced by the Precompile step?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Dec 29, 2013 10:29 pm
Reply with quote

Hello,

To do what I believe you want, you need to read the individual rows and store them in an array - one way or another. The array name cannot be used to receive the individual entries.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Dec 30, 2013 4:18 pm
Reply with quote

dick scherrer wrote:
To do what I believe you want, you need to read the individual rows and store them in an array - one way or another. The array name cannot be used to receive the individual entries.
Not true.

I don't see any mistake in the cobol/sql coding (besides a discrepancy between 10 rows and occurs 3000 , but that shouldn't be a problem)

I would check the output, version of the precompiler and if you don't find anything out of the ordinary : open a PMR with IBM.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Dec 30, 2013 7:51 pm
Reply with quote

Hi Guy,

My reply was not worded so well and i may be completely off-base . . .

It was my understanding that to read an 'array" one used the multi-row fetch?

As coded, how will the array be incremented as single rows are fetched?

Check your PM please.

d
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Dec 30, 2013 9:03 pm
Reply with quote

fetch rowset for 10 rows is a multi-row fetch (of 10 rows)
each execution will fill up WS-SEC-NO (1..10)

It does not mean that doing it 300 times will fill up the 3000-occ table, maybe that is the confusion.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Dec 30, 2013 9:26 pm
Reply with quote

Thanks for the correction/clarification.

i appreciate you keeping me straight icon_smile.gif

d
Back to top
View user's profile Send private message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Tue Dec 31, 2013 3:04 pm
Reply with quote

Hi,

Please find below precompiler details getting at the time of compilation

DB2 SQL PRECOMPILER VERSION 10 REL. 1.0
OPTIONS SPECIFIED: APOST,APOSTSQL,VERSION(AUTO),HOST(IBMCOB),NEWFUN(NO)

PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0
Invocation parameters:
NOSEQ,MAP,LIST,

IGYOS4020-W The "OFFSET" option was discarded due to option
conflict resolution. The "LIST" option from compiler
invocation parameter took precedence.

We also got below warning message at the end of compilation:

IGYDS0139-W Diagnostic messages were issued during processing of
compiler options. These messages are located at the
beginning of the listing.

Thanks.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Wed Jan 01, 2014 2:23 am
Reply with quote

Were there any pre-compile errors? When I reproduced your code (with a minor change to point to one of our local tables), I got the following error:
Code:
 DSNH5011I E     DSNHSMUD LINE 81 COL 24  HOST VARIABLE ARRAY "WS-BRANCH-NUM" IS EITHER NOT DEFINED OR IS NOT USABLE
FETCH NEXT ROWSET FROM TST_CSR FOR 10 ROWS INTO : WS-BRANCH-NUM                                                     
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Jan 03, 2014 7:44 am
Reply with quote

May be a wild guess to declare it like below if 10 is going to be constant all the times.

Code:
01  WS-CURSOR_DATA-HD.                                     
    05  WS-SEC-NO              PIC X(5) OCCURS 10 TIMES.
Back to top
View user's profile Send private message
kameswaramanoj.Akella

New User


Joined: 28 Mar 2013
Posts: 7
Location: india

PostPosted: Fri Jan 03, 2014 2:10 pm
Reply with quote

Try fetching the data into the group variable 'WS-CURSOR_DATA-HD'
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Jan 03, 2014 2:31 pm
Reply with quote

Aaargh. just noticed the underscore.
AFAIK : no underscores in host-variables.
Back to top
View user's profile Send private message
kameswaramanoj.Akella

New User


Joined: 28 Mar 2013
Posts: 7
Location: india

PostPosted: Fri Jan 03, 2014 2:36 pm
Reply with quote

Hi GuyC,

copied it from the actual code from the post...I too just noticed icon_smile.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sat Jan 04, 2014 1:51 am
Reply with quote

I re-created the problem, and the underscore does not cause the precompiler to complain, yet the generated Cobol is incorrect.

This looks like a precompiler bug to me. An underscore is a valid character in a Cobol variable name, so the precompiler should have generated valid Cobol code.

This is the DSNHADDR2 call generated when the underscore is present:

Code:
CALL 'DSNHADD2' USING SQL-AVAR-ADDRS1 IN
SQL-AVAR-LIST4(1) SQL-NULL.             


Change the underscore to a hyphen and the generated code looks like this:
Code:
CALL 'DSNHADD2' USING SQL-AVAR-ADDRS1 IN           
SQL-AVAR-LIST4 WS-LOGON-ID OF FILLER-02(1) SQL-NULL.
Note: in my version of the code WS-LOGON-ID is the field that occurs 3000 times.
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: Sat Jan 04, 2014 4:40 pm
Reply with quote

Good spot Don!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Jan 05, 2014 2:53 am
Reply with quote

Quote:
Good spot Don!

And thanks for posting!

d
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Jan 06, 2014 6:23 pm
Reply with quote

underscore is valid in cobol, not in DB2 hostvariable.
This is a very special case : the hostvariable itself does not contain underscore, but the groupfield does;
Could be worth reporting this to IBM.

Thx for investigating, Don.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Jan 07, 2014 4:24 am
Reply with quote

Just to add further, if we try to use underscore at sub level like,

Code:
01  WS-CURSOR-DATA-HD.                                     
    05  WS_SEC_NO              PIC X(5) OCCURS 3000 TIMES.

then precompiler doesn't give any error and it goes as a successful compilation.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
Search our Forums:

Back to Top