Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am attempting to create a global

Status
Not open for further replies.

gowster

Programmer
Aug 24, 2005
6
US
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
 
"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?
 
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

FAQ219-2884
FAQ181-2886
 
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
 
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


 
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top