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
 

 

Single row update in DB2 Z/OS using an array as host variabl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
jdeeponline

New User


Joined: 08 Sep 2009
Posts: 27
Location: Charlotte

PostPosted: Mon Mar 18, 2013 2:45 pm    Post subject: Single row update in DB2 Z/OS using an array as host variabl
Reply with quote

We are trying to introduce multi-row Inserts in our COBOL DB2 modules, replacing the existing single row inserts. While introducing this, we want to retain the existing Single row INSERT and UPDATE queries in the program , so that anyone who desires to could use this.

The single row insert works just fine even while providing an array as host variable, by passing the values only to the first row of array before inserting. We are not sure if the performance will be impacted by this.

However, while trying to keep the Update statement, the recompile of the program failed.

Any thoughts on that above will be appreciated.
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1755
Location: Bloomington, IL

PostPosted: Mon Mar 18, 2013 4:00 pm    Post subject:
Reply with quote

My thought is that you need to provide more detail.
Back to top
View user's profile Send private message
jdeeponline

New User


Joined: 08 Sep 2009
Posts: 27
Location: Charlotte

PostPosted: Mon Mar 18, 2013 4:59 pm    Post subject: Reply to: Single row update in DB2 Z/OS using an array as ho
Reply with quote

In the COBOL module, we will have 2 queries on either sides of an IF statement. First, to insert one row of input at a time with an INSERT statement, and the next to be able to INSERT multiple rows. While running the program, we can pass a parameter in the JCL to control which of the options would be used.

Now, I can't declare the table twice in the program (one for each query) to be able to use a DCLGEN. So I declare it once, defining the the cobol variables as an array. I want to be able to use this same COBOL variable as a host variable, and use them for my Multi-Insert, single row Insert and run an UPDATE query as well on the table, based on the PARM passed in the JCL. When I attempt this, the compiler gives me an error in Changeman (for the UPDATE SQL).
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Mar 18, 2013 9:13 pm    Post subject:
Reply with quote

Possibly, create an DCLGEN equivalent COPYBOOK having :TAG: in it. Later in program in IF/ELSE statement replace :TAG: with appropriate variable names, e.g.:
Code:
COPY copybook REPLACING ==:TAG:== BY ==snglrow==.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 7 Mon Mar 27, 2017 3:59 pm


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