Moving alphanumeric data to a binary field



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Moving alphanumeric data to a binary field

Postby ctrevino » Fri Mar 19, 2010 12:18 am

Hi all, it's me again with another off the wall question.

If I have a regular 50 page report, say I put it in a flat file. How can I convert this to binary using COBOL?

We are trying to replace (as you already know if you have been reading all my crazy questions) our dynamic output routine that sends reports directly to printers.

Right now, I have been tasked with getting the report from a flat file with alphanumeric data into a BLOB which is a binary large object. This is a DB2/SQL Server data type and basically means you can put a big butt amount of data into it. They have a CLOB also which is character large object. But, the boss wants to distribute this kind of like an RSS feed but it will be an Atom Publishing Protocol feed. So, binary works better for him as his program will be in java.
If you haven't fallen asleep yet, I would love any input that would set me off in the right direction.

Thanks in advance, :D

Christy
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Moving alphanumeric data to a binary field

 

Re: Moving alphanumeric data to a binary field

Postby dick scherrer » Fri Mar 19, 2010 2:36 am

Hi Christy,

One way might be to insert the report into a db2 table as a blob and then unload this blob for distribution. . .

Just an untested thought . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Moving alphanumeric data to a binary field

Postby ctrevino » Fri Mar 19, 2010 8:30 pm

You know, Dick. You swear you aren't a mind reader but so far you have done a pretty good job with mine. :D

So, I can insert the report into a Blob field in my db2 table without converting to binary first?

That is essentially what I have been looking at since yesterday afternoon. However, I have about talked myself into a CLOB. But get this, our server DBA tells me that they don't have an equivalent field type in our version of SQL server. (and they call the mainframe backwards, geesh).

Anyway, DB2 with a BLOB or CLOB is the way I am going with this. The matching server SQL server table field is defined as TEXT.
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Moving alphanumeric data to a binary field

Postby dick scherrer » Fri Mar 19, 2010 11:51 pm

Hi Christy,

So, I can insert the report into a Blob field in my db2 table without converting to binary first?
You should be able to. . . Whatever uses the data will have to read the blob and convert to something useful.

For y2k i supported some SqlServer databases that were being migrated rather than remediated. SqlServer could handle this back then. . Maybe this could help your server dba(s)? From an almost 10-year-old article. . .
Importing BLOB Data into SQL Server

Before you think about retrieving binary data from SQL Server, you need to get that data into the database in the first place. Binary files are typically produced by applications outside of SQL Server and are most commonly stored as standard OS files. Some of the most common binary file types contain image data and carry .bmp, .jpeg, .gif, and .tif extensions. Other binary data takes the form of sound files, which typically have the file extension .wav or .mp3. Another type of binary data that you might want to store in SQL Server is video data, which consists of both image and sound data. Video files typically end in the extension .avi, .mpeg, or .asx. Although these various BLOB files contain different types of data, SQL Server stores them all in the same way. The code in Listing 1 illustrates how you can use the ADO Stream object to import a .jpeg image into a SQL Server table. (Although this discussion centers on multimedia data, you can use SQL Server's image data type to store any type of binary object, including Microsoft Word .doc files, PowerPoint .ppt files, or even .exe executable programs.)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post