IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

cobol embedded sql


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Oct 14, 2016 4:07 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 14, 2016 5:35 pm
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: 446
Location: USA

PostPosted: Fri Oct 14, 2016 8:07 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Oct 14, 2016 8:39 pm
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

Global Moderator


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

PostPosted: Fri Oct 14, 2016 9:23 pm
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: 2455
Location: Hampshire, UK

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

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Oct 15, 2016 2:56 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top