INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

I am attempting to create a global

I am attempting to create a global

(OP)
I am attempting to create a global temporary table in a COBOL program. I am getting the followoing messages:

DSNH029I E DSNHAPL2 LINE 795 COL 15 "INTO" CLAUSE REQUIRED
DSNH050I I DSNHMAIN WARNINGS HAVE BEEN SUPPRESSED DUE TO LACK OF TABLE DECL
the following are the parts of the program as I coded it:

EXEC SQL
DECLARE GLOBAL TEMPORARY TABLE TEMP_MAC
(MACBANK CHAR(2) NOT NULL,
MACDATEG CHAR(18) NOT NULL,
MACDATEJ CHAR(6) NOT NULL,
MACNAME CHAR(40) NOT NULL,
MACPLNIN CHAR(1) NOT NULL
)
END-EXEC.

000-INITIALIZATION-EXIT.
EXIT.
EXEC SQL
INSERT INTO TEMP_MAC
(MACBANK,
MACDATEG,
MACDATEJ,
MACNAME,
MACPLNIN
)
VALUES
(:WS-MACBANK,
:WS-MACDATEG,
:WS-MACDATEJ,
:WS-MACNAME,
:WS-MACPLNIN
)
END-EXEC.

EXEC SQL
SELECT *
FROM TEMP_MAC
FETCH FIRST 10 ROWS ONLY
END-EXEC.

100-READ-WRITE-EXIT.
Can any anyone assist me?

thanks

RE: I am attempting to create a global

"DSNH029I E DSNHAPL2 LINE 795 COL 15 "INTO" CLAUSE REQUIRED"

Which is line 795?

Why is there a fetch for 10 rows and only 1 will be inserted?

RE: I am attempting to create a global

EXEC SQL
SELECT *
FROM TEMP_MAC
FETCH FIRST 10 ROWS ONLY
END-EXEC.

the above is incorrect - a select has to be defined either in a cursor, or it has to have "INTO variable(s)" - that is the source of the error as you have neither

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: I am attempting to create a global

Gowster
As frederico pointed out, you need variables to receive the data in cobol. As you are attempting to pull back into the program the first 10 rows of the table, I think you need to code a declare cursor, open, fetch (plus processing) and a close.
Marc

RE: I am attempting to create a global

(OP)
Thank you all. I did make make some changes but encountered a new problem as follows:
EXEC SQL
DECLARE CURSOR1 CURSOR FOR
SELECT *
FROM TEMP_MAC
END-EXEC

EXEC SQL
DECLARE GLOBAL TEMPORARY TABLE TEMP_MAC
(MACBANK CHAR(2) NOT NULL,
MACABANK CHAR(3) NOT NULL,
MACDATEG CHAR(18) NOT NULL,
MACDATEJ CHAR(6) NOT NULL,
MACNAME CHAR(40) NOT NULL,
MACPLNIN CHAR(1) NOT NULL
)
ON COMMIT PRESERVE ROWS
END-EXEC.

EXEC SQL
OPEN CURSOR1
END-EXEC.

000-INITIALIZATION-EXIT.
EXIT.
READ MAC-FILE
NEXT RECORD
AT END
SET MAC-EOF TO TRUE
NOT AT END
IF MAC-FL-STAT NOT = '00' AND NOT EQUAL '97'
MOVE '130-READ-MERCHANT-FILE' TO ABND-PRGPH-NAME
DISPLAY 'FAILURE TO READ MAC-FILE '
DISPLAY 'FILE STATUS : ' DRT-FL-STAT
MOVE MAC-FL-STAT TO ABND-CODE
PERFORM 999-ABND-RTN
END-IF
END-READ.

ADD +1 TO MAC-READ-COUNT.

MOVE MACBANK TO WS-MACBANK
MOVE MACABANK TO WS-MACABANK
MOVE MACDATEG TO WS-MACDATEG
MOVE MACDATEJ TO WS-MACDATEJ
MOVE MACNAME TO WS-MACNAME
MOVE MACPLNIN TO WS-MACPLNIN.


EXEC SQL
INSERT INTO TEMP_MAC
(MACBANK,
MACABANK,
MACDATEG,
MACDATEJ,
MACNAME,
MACPLNIN
)
VALUES
(:WS-MACBANK,
:WS-MACABANK,
:WS-MACDATEG,
:WS-MACDATEJ,
1----+----2----+----3----+----4----+----5---
)
VALUES
(:WS-MACBANK,
:WS-MACABANK,
:WS-MACDATEG,
:WS-MACDATEJ,
:WS-MACNAME,
:WS-MACPLNIN
)
END-EXEC.


EXEC SQL
FETCH CURSOR1
INTO :WS-HOLD-MACBANK,
:WS-HOLD-MACABANK,
:WS-HOLD-MACDATEG,
:WS-HOLD-MACDATEJ,
:WS-HOLD-MACNAME,
000-END-PROCESS.

EXEC SQL
CLOSE CURSOR1
END-EXEC
CLOSE MAC-FILE.
CLOSE RPT-FILE.
ACTION(REPLACE)
DSNX200I -T10D BIND SQL ERROR
USING VPSVBE1V AUTHORITY
PLAN=(NOT APPLICABLE)
DBRM=REFORMA2
STATEMENT=659
SQLCODE=-204
SQLSTATE=42704
TOKENS=VPSVBE1V.TEMP_MAC
CSECT NAME=DSNXOTL
RDS CODE=-500
DSNX200I -T10D BIND SQL ERROR


RE: I am attempting to create a global

This might be an authority issue. The manual says:

Authorization

The privileges held by the authorization ID of the statement must include at least one of the following:

SYSADM or DBADM authority
USE privilege on the USER TEMPORARY table space

Do you know if you've got that auth?

Marc

RE: I am attempting to create a global

(OP)
Hello all
Finally, I have an answer to the questionI posed. This is a mainframe COBOL DGTT pgm that I was attenpting. Apparently, I needed to adD the keyword SESSION. to the DGTT. wherever it is refrenced (declare, cursor, insert etc). the pgm compiled and ran.

RE: I am attempting to create a global

Thanks for letting us know the answer.

Marc

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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