View previous topic :: View next topic |
Author |
Message |
cappertan Beginner
Joined: 20 May 2003 Posts: 15 Topics: 10
|
Posted: Thu Jun 24, 2004 11:59 am Post subject: Easytrieve SQL format to access table via UDB |
|
|
I want to access a table that I am connecting to via UDB. In my SQL, in Easytrieve, would I code something like? :
SELECT PAT_ID, DEPARTMENT_ID
FROM HCCLDCO1.HCCLCO.PAT_ENC
HCCLDCO1 is the "CONNECTION LOCATION". (I use this in a SPUFI and I am able to the do the above quire[/code] _________________ Capp |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Jun 24, 2004 12:23 pm Post subject: |
|
|
cappertan,
You can code the same sql even in easytrieve but you need to code it as a cursor. check the example below for a sample ezt code
Code: |
//STEP0100 EXEC PGM=EZTPA00
//STEPLIB DD DSN=EASYTREV.PROD.LOADLIB,
// DISP=SHR
// DD DSN=EASYTREV.PROD.DB2P.LOADLIB,
// DISP=SHR
//EZTVFM DD UNIT=DISK,SPACE=(CYL,(200,50),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSSNAP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSIN DD *
DEFINE WS-PAT-ID W 10 A
DEFINE WS-DEPT-ID W 05 N 0
SQL DECLARE C1 CURSOR FOR +
SELECT PAT_ID +
,DEPARTMENT_ID +
FROM HCCLDCO1.HCCLCO.PAT_ENC +
WHERE 1ST COND = 'CAP' +
AND OTHER COND = 'MVS' +
WITH UR
JOB INPUT NULL
WS-PAT-ID = ' '
WS-DEPT-ID = 0
PERFORM FETCH-TABLE-DATA
FETCH-TABLE-DATA. PROC
SQL OPEN C1
IF SQLCODE EQ 0
SQL FETCH C1 +
INTO :WS-PAT-ID +
,:WS-DEPT-ID
IF SQLCODE NE 0 AND +
SQLCODE NE 100 AND +
SQLCODE NE -811 AND +
RETURN-CODE = 0999
PERFORM ABEND
END-IF
END-IF
IF SQLCODE NE 0
DISPLAY 'PAT NOT FOUND : '
END-IF
SQL CLOSE C1
END-PROC
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
shiv_swami Beginner
Joined: 29 Nov 2003 Posts: 68 Topics: 14
|
Posted: Wed Jul 14, 2004 9:03 am Post subject: |
|
|
Kolusu,
When I try to run easytrieve program with embedded cursors.My job fails with error :
JESMSGLOG:
Code: | CSV003I REQUESTED MODULE DQSPSCV NOT FOUND
CSV028I ABEND806-04 JOBNAME=EZTDB2TR STEPNAME=EZTCOMPL |
SYSPRINT:
Code: |
SQL DECLARE C1 CURSOR FOR
*******B204 SQL - MODULE DQSPSCF NOT FOUND |
Please guide me in setting proper libraries so that module is found. _________________ Regards,
Shivprakash |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jul 14, 2004 9:20 am Post subject: |
|
|
Shiv,
Look at the steplib definition in my JCL. You need to concatenate the easytrieve/DB2 loadlib for the job.
Each shop has their own standard of naming the load libraries. Try to check the other load libraries with the high-level qualifier that you use to define the ezt loadlib.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
cappertan Beginner
Joined: 20 May 2003 Posts: 15 Topics: 10
|
Posted: Wed Jul 21, 2004 3:40 pm Post subject: Easytrieve compiling to access Teradata dbms on udb |
|
|
Kolosu. Hi:
Is this an issue for concatenation as well? We, at my shop, are migrating to Teradata dbms. Since we are running Teradata on a windows based server, access will be via UDB or another method.
How is the package/plan set up to access the tables on Teradata for Easytrieve so that I can do a dynamic link/bind? This would be a read only access.
My error from the attemped compile follows:
SELECT PAT_ID FROM HCCLDCO1.HCCLCO.PAT_ENC +
WHERE PAT_ID = :IN_HRN
**B204 SQL - DSNT408I SQLCODE = -805, ERROR: DBRM OR PACKAGE NAME HCCLDCO1
**B204 SQL - NOT FOUND IN PLAN DQPS24C. REASON 01
HCCLDCo1 is the CONNECTION LOCATOR. _________________ Capp |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Jul 21, 2004 3:50 pm Post subject: |
|
|
Cappertan,
You need to contact your DBA to enable DRDA(Distributed Request Data Access). SYSIBM.LOCATIONS table will have information for every accessible remote server.
Check this link which discusses Accessing tables in different DB2 sub-systems
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|