db2 to ksds file

Post your questions related to VSAM

Moderator: Moderator Group

Post Reply
nithyalohith
Member
Posts: 1
Joined: Thu Jun 18, 2009 9:39 pm

db2 to ksds file

Post by nithyalohith » Thu Jun 18, 2009 9:42 pm

i need the logic to write records from db2 table into a ksds file!!plz help

User avatar
Vamsi99
Active Member
Posts: 183
Joined: Wed Nov 05, 2008 11:20 am

DB2 PROGRAM - writing records into KSDS file.

Post by Vamsi99 » Thu Jun 18, 2009 9:46 pm

It is as simple as reading data from db2 table and writing into ksds file.

What help exactly you required?

First step is to read data from DB2. Did you completed that program?

Narendra.nareddy
Member
Posts: 9
Joined: Thu Nov 27, 2008 4:45 pm

VSAM - File system

Post by Narendra.nareddy » Wed Aug 05, 2009 10:40 am

Hi,

1. When you are reading a DB2 table we need to be sure abt the output which are getting, because if your SELECT statement retrives more rows than one then we need to use CURSORS.

2. If CURSORS are using just after feteching the data move the variables to VSAM file variables and write to VSAM file.

Thanks
Narendra

anilsani285
Member
Posts: 10
Joined: Sun Jul 04, 2010 5:26 pm

Post by anilsani285 » Wed Jul 07, 2010 10:20 pm

hi,

USE CURSORS TO FETCH THE RECORD FROM THE TABLE INTO HOST VARIABLES THEN MOVE THEM TO RECORD LAYOUT OF THE VSAM FILE THEN PROVIDE A WRITE STATEMENT ....

FETCH CURSOR INTO :HS-ACCT-NO,:HS-ACCT-TYPE,:HS-ACCT-BAL

WRITE ACCTVSAM INVALID KEY DISPLAY 'ERROR'

CORRECT ME IF IAM WRONG...

THANKS
Anil-Sani

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others