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 + DB2

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


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Wed Feb 26, 2003 1:12 am    Post subject: Easytrieve + DB2 Reply with quote

Hi,

I am interested in knowing the way in which you can access DB2 tables through Easytrieve. Is it that you write embedded SQLs in the Easytrieve programs just like you do in COBOL or use some standard APIs to do the same by passing the SQL as a parameter to standard APIs. If you see how DB2 tables are accessed in REXX, it is by use of some standard APIs. As Easytrieve is also basically an interpreted language, I was thinking if the same happens in this case also.
If embedded SQLs are used in Easytrieve, I would also like to know how you connect to the DB2 subsystem when you run the program. It cannot be run through IKJEFT01...right??

Thanks and Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Venkata Ramana Reddy
Beginner


Joined: 02 Dec 2002
Posts: 70
Topics: 19
Location: California

PostPosted: Wed Feb 26, 2003 2:54 pm    Post subject: Reply with quote

Manas,
Here is the sample code.
Code:

//EZTRUN   EXEC PGM=EZTPA00
//SYSPRINT DD SYSOUT=*                                                 
//SYSABEND DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//EZTVFM   DD UNIT=SYSDA,SPACE=(CYL,(25,25))                           
//EZTMAC   DD DSN=YOUR.MACLIB,DISP=SHR                           
//INFILE   DD DSN=YOUR.INPUT.FILE,DISP=SHR           
//SYSIN    DD *                                                         
 PARM DB2SSID('DSP2')
*
FILE INFILE
  INFILE-REC    01 80 A

SQL INCLUDE LOCATION W FROM YOURDB2TABLE1
*
SQL DECLARE YOURCSR CURSOR FOR   +
    SELECT  COLUMN1,             +
           COLUMN2               +
      FROM  YOURDB2TABLE1        +
      WHERE  YOUR CONDITION
*                                                                       
JOB INPUT (INFILE) START(INIT-RTN) FINISH (LAST-RTN)

SQL OPEN YOURCSR

IF SQLCODE NE 0 AND SQLCODE NE 100
   DISPLAY ' SQL CODE : ' SQLCODE
END-IF
*                 
*                                                                       
SQL FETCH YOURCSR    +
    INTO :WS-COL1,       +
            :WS-COL2
*                   
*                                                                                                 
IF SQLCODE NE 0 AND SQLCODE NE 100
   DISPLAY ' SQL CODE : ' SQLCODE
END-IF
*                                               
SQL CLOSE YOURCSR
*                                                                       
*                                               
IF SQLCODE NE 0 AND SQLCODE NE 100
   DISPLAY ' SQL CODE : ' SQLCODE
END-IF

*                                               
INIT-RTN. PROC                                                         
    DISPLAY 'Easytrieve DB2 Process Started'                                                     
END-PROC
*                                                                       
LAST-RTN. PROC                                                         
    DISPLAY 'Easytrieve DB2 Process Ended'
END-PROC                                                               
/*                                                                     
//                                                                     


_________________
Venkataramana
-- Good judgement comes from experience, and often experience comes from bad judgement.
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Thu Feb 27, 2003 1:04 am    Post subject: Reply with quote

Hi ravijaya,

Thanks a lot for your response. I talked about Easytrieve being an interpreted language because in our system, we primarily don't compile any easytrieve programs. We give them in the SYSIN of EZTPA00. The whole program is interpreted during runtime. Please correct me if I am wrong. I know that you can also use the compiled version of Easytrieve but I personally have never used that.

Hi Venkata Ramana Reddy,

Thanks a lot for your code. It was really helpfull. I have never really worked a lot on Easytrieve expect for a couple of programs almost a year back. I guees, I have to refresh a little on that.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Venkata Ramana Reddy
Beginner


Joined: 02 Dec 2002
Posts: 70
Topics: 19
Location: California

PostPosted: Fri Feb 28, 2003 1:07 pm    Post subject: Reply with quote

Manas,
Here is the sample JCL to compile, Link edit and run the Easytrieve program
Code:

//********************************************************************
//* Jcl to compile, Link edit and run the Easytrieve program         *
//********************************************************************
//*
//********************************************************************
//* Compile the Easytrieve program                                   *
//********************************************************************
//EZTCOMPL EXEC PGM=EZTPA00
//EZTVFM   DD UNIT=SYSDA,SPACE=(CYL,(25,25))
//SYSPRINT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSLIN   DD DSN=&&SYSLIN,
//            UNIT=SYSDA,SPACE=(CYL,(20,20),RLSE),DISP=(,PASS)
//SYSIN    DD *
PARM LINK(UREZTPGM R)
Your Easytrieve code goes here
/*
//*
//*********************************************************************
//* Link Edit the Easytrieve program                                  *
//*********************************************************************
//EZTLINK  EXEC PGM=IEWL
//SYSPRINT  DD SYSOUT=*
//SYSLMOD   DD DSN=YOUR.EZT.LOADLIB,DISP=SHR
//SYSUT1    DD UNIT=SYSDA,SPACE=(CYL,(1,5))
//SYSLIN    DD DSN=&&SYSLIN,DISP=(OLD,DELETE,DELETE)
//*
//*********************************************************************
//* Run the Easytrieve program                                        *
//*********************************************************************
//EZTRUN   EXEC PGM=UREZTPGM
//STEPLIB  DD DSN=YOUR.EZT.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*                       
//SYSABEND DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//

_________________
Venkataramana
-- Good judgement comes from experience, and often experience comes from bad judgement.
Back to top
View user's profile Send private message
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