Easytrieve + DB2
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Application Programming

#1: Easytrieve + DB2 Author: Manas BiswalLocation: Chennai, India PostPosted: Wed Feb 26, 2003 1:12 am
    —
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

#2:  Author: Venkata Ramana ReddyLocation: California PostPosted: Wed Feb 26, 2003 2:54 pm
    —
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                                                               
/*                                                                     
//                                                                     


#3:  Author: Manas BiswalLocation: Chennai, India PostPosted: Thu Feb 27, 2003 1:04 am
    —
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

#4:  Author: Venkata Ramana ReddyLocation: California PostPosted: Fri Feb 28, 2003 1:07 pm
    —
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=*                       
//



MVSFORUMS.com -> Application Programming


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group