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
 

 

Compiler error IGYPS2120-S Expected a reference-modification

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Compiler error IGYPS2120-S Expected a reference-modification
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Fri Dec 27, 2013 7:14 pm    Post subject: Reply to: Compiler error IGYPS2120-S Expected a reference-mo
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    Post subject: Reply to: Compiler error IGYPS2120-S Expected a reference-mo
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: 641
Location: Whitby, ON, Canada

PostPosted: Sun Dec 29, 2013 10:17 pm    Post subject:
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

Site Director


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

PostPosted: Sun Dec 29, 2013 10:29 pm    Post subject:
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: 1278
Location: Belgium

PostPosted: Mon Dec 30, 2013 4:18 pm    Post subject:
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

Site Director


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

PostPosted: Mon Dec 30, 2013 7:51 pm    Post subject:
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: 1278
Location: Belgium

PostPosted: Mon Dec 30, 2013 9:03 pm    Post subject:
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

Site Director


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

PostPosted: Mon Dec 30, 2013 9:26 pm    Post subject:
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    Post subject: Reply to: Compiler error IGYPS2120-S Expected a reference-mo
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: 641
Location: Whitby, ON, Canada

PostPosted: Wed Jan 01, 2014 2:23 am    Post subject:
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

Senior Member


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

PostPosted: Fri Jan 03, 2014 7:44 am    Post subject:
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    Post subject:
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: 1278
Location: Belgium

PostPosted: Fri Jan 03, 2014 2:31 pm    Post subject:
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    Post subject:
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: 641
Location: Whitby, ON, Canada

PostPosted: Sat Jan 04, 2014 1:51 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Sat Jan 04, 2014 4:40 pm    Post subject: Reply to: Compiler error IGYPS2120-S Expected a reference-mo
Reply with quote

Good spot Don!
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: Sun Jan 05, 2014 2:53 am    Post subject:
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: 1278
Location: Belgium

PostPosted: Mon Jan 06, 2014 6:23 pm    Post subject:
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

Senior Member


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

PostPosted: Tue Jan 07, 2014 4:24 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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
No new posts IDMS/DC-COBOL program - SNAP error wh... rakeshsekar1987 IDMS/ADSO 5 Tue Sep 13, 2016 8:28 pm


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