Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

I need code to use EZTRIEVE for DB2 table read

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
mangalabhishek

New User


Joined: 16 May 2007
Posts: 1
Location: US

PostPosted: Fri Jun 01, 2007 7:49 pm    Post subject: I need code to use EZTRIEVE for DB2 table read
Reply with quote

I need code to use EZTRIEVE for DB2 table read.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jun 01, 2007 7:54 pm    Post subject: Re: I need code to use EZTRIEVE for DB2 table read
Reply with quote

You know I have to ask - is this information not available in the product's user's manual(s)?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sat Jun 16, 2007 3:25 am    Post subject:
Reply with quote

Instream EZTrieve for reading db2
Code:

//STEP02   EXEC EASYPLUS,PANDD1='MACROLIBRARY',COND=(4,LT)
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//OUTFILE1 DD DSN=SOME.OUTPUT.FILE,
//         DISP=(NEW,CATLG,DELETE),
//         UNIT=TEST,SPACE=(CYL,(50,50),RLSE),
//         DCB=(LRECL=100,RECFM=FB,BLKSIZE=0)
//SYSIN    DD *
*
PARM SSID('DB2SUBSYSTEM ID')
*
FILE OUTFILE1
 O-FIRST-NAME               1   30 P
 O-LAST-NAME               31   30 A
 O-PHONE                   61   10 A
 O-ADDRESS                 71   30 A
*************************************************************
**                  WORKING STORAGE
*************************************************************
SW-FILE-END                 W    1   A VALUE 'N'
*
SQL DECLARE PERSON  CURSOR FOR                                   +
     SELECT   FIRST_NAME                                         +
             ,LAST_NAME                                          +
             ,PHONE_NUMBER                                       +
             ,ADDRESS                                            +
      FROM   tableowner.TABLENAME                                +
             WHERE  FIRST_NAME =  'WILLIAM'                      +
         WITH UR
*
************************************************************
**                  ACTIVITY SECTION
*************************************************************
JOB INPUT NULL
  SQL OPEN PERSON
  PERFORM CHECK-SQL-CODE
  DO WHILE SW-FILE-END NE 'Y'
     SQL FETCH PERSON INTO :O-FIRST-NAME               +
                           ,:O-LAST-NAME       +
                           ,:O-PHONE         +
                           ,:O-ADDRESS
     PERFORM CHECK-SQL-CODE
     IF SQLCODE < 0
       SQL CLOSE CONTACT
       DISPLAY 'BAD FETCH'
       STOP
     ELSE
       IF SQLCODE EQ 0
          PUT OUTFILE1
       ELSE
         IF SQLCODE = +100
            SW-FILE-END = 'Y'
         END-IF
       END-IF
     END-IF
  END-DO
  SQL CLOSE PERSON
  PERFORM CHECK-SQL-CODE
  STOP
*===============================================
CHECK-SQL-CODE. PROC.
IF SQLCODE NE 0 AND SQLCODE NE 100
    DISPLAY 'SQL CODE = '  SQLCODE
    DISPLAY 'SQL ERROR MESSAGE = '  SQLERRM
    STOP EXECUTE
END-IF
END-PROC
*===============================================
[/code]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us