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
 

 

cobol embedded sql

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
MS_Developer

New User


Joined: 14 Oct 2016
Posts: 1
Location: germany

PostPosted: Fri Oct 14, 2016 2:39 pm    Post subject: cobol embedded sql
Reply with quote

Hi any body's
I'm a developer in Microsoft World, exactly MS-SQL-Server ;-)
My question ist:
How can I export W-Daten into an SQL-Server in one step and also from SQL-Server back into W-Daten?

What ist :W-Daten ? Is it an array or is it a string variable ??
How can I read this values out from :W-Daten? maybe with a Loop constructor ? in Visual Basich is it a For i=0 to x .... Next

for your information, I'm not COBOL expert only Expert in Microsoft World, exactly MS-SQL-Server ;-)

Her are a COBOL snippet :

Code:
01 W-DATEN.
  05 FILLER PIC X(1024) OCCURS 500 TIMES.

EXEC SQL
     insert into Tabelle (GROOOOSSSE_SPALTE)
       values (:W-DATEN)
END-EXEC


This sql statement not works :-(

Code'd

brgds
Frank
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Oct 14, 2016 4:07 pm    Post subject: Reply to: cobol embedded sql
Reply with quote

This has nothing to do with Mainframes, I suspect.

Your biiiiiggg column can contain 500k of data?

I'm not sure what you mean by "read out". If you wanted to put that 500k in the "host variable" somewhere else, you could just MOVE W-Daten TO somewhere-else (assuming you define it).

If you want to do something else with it, psychic day was Wednesday this week. Which also applies to your "doesn't work" SQL statement.

At a wild guess I'd say you've forgotten to press the power button on the little box containing your server, but that is a completely wild guess and almost certainly wrong.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Oct 14, 2016 5:35 pm    Post subject:
Reply with quote

Quote:
What ist :W-Daten ? Is it an array or is it a string variable ??
Be aware that COBOL dates back to 1959 and hence there is no such thing as a "string" in COBOL like in Java or Perl or C or ... And as your code snippet has it defined, W-Daten is an alphanumeric group level variable of 524,288 bytes. It contains an array but it is not an array.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Fri Oct 14, 2016 8:07 pm    Post subject: Reply to: cobol embedded sql
Reply with quote

Quote:
This sql statement not works :-(

What is the Sqlcode? If you could find that then, I think, your problem will be solved.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Fri Oct 14, 2016 8:39 pm    Post subject:
Reply with quote

Welcome!!
DATEN (German- lang) -- > Data (English- Lang)
1. You cannot be able to do this because DB2 wants one ROW at a time, so you would need to have some kind of loop where WS-DATEN is moved to another variable of 1024 size and then use that <another variable> in the same insert query and perform this until 500 times or WS-DATEN=SPACES
2. Look for MULTI INSERT where you can provide # of rows that you are inserting.

So next time, provide us the error messages along with the SQL and there is something called "BB Codes" which you can use representing the data.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Oct 14, 2016 9:23 pm    Post subject:
Reply with quote

Also an option to consider :

If you could export the data to dataset , LOAD utility could be considered as well.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Sat Oct 15, 2016 2:43 am    Post subject:
Reply with quote

Which COBOL are you using?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Sat Oct 15, 2016 2:56 am    Post subject: Reply to: cobol embedded sql
Reply with quote

Rohit, you didn't translate the biiiiiiiiiiggg_column. Seems to me the column is, well, big, and 1024 doesn't cut big.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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