MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Easytrieve SQL format to access table via UDB

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
cappertan
Beginner


Joined: 20 May 2003
Posts: 15
Topics: 10

PostPosted: Thu Jun 24, 2004 11:59 am    Post subject: Easytrieve SQL format to access table via UDB Reply with quote

I want to access a table that I am connecting to via UDB. In my SQL, in Easytrieve, would I code something like? Question :
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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Jun 24, 2004 12:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
shiv_swami
Beginner


Joined: 29 Nov 2003
Posts: 68
Topics: 14

PostPosted: Wed Jul 14, 2004 9:03 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Jul 14, 2004 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
cappertan
Beginner


Joined: 20 May 2003
Posts: 15
Topics: 10

PostPosted: Wed Jul 21, 2004 3:40 pm    Post subject: Easytrieve compiling to access Teradata dbms on udb Reply with quote

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. Confused
_________________
Capp
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Jul 21, 2004 3:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group