How to insert some DUMMY value to BLOB field



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

How to insert some DUMMY value to BLOB field

Postby hariharan_bk » Tue Jun 07, 2016 10:45 pm

Hi All,

Lets consider table A has 5 columns and i need to insert a row here.

For COL1 - 4, we have the data
and for col - 5 which is a BLOB field and is declared as NOT NULL, we dont have any data from input sources. Our requirement is to insert some dummy values into this BLOB field for now. I have tried many ways to insert dummy fields into this field .. and all in vain.

BLOB(X'123')
cast(x'000001' as blob) and so many...



INSERT INTO DATA_BLOB_DUMMY     
     (                            
       COL1, COL2, COL3, COL4              
      , BLOB_FIELD                
     )                            
VALUES                            
     (                            
      :COL1
,      :COL2
,      :COL3
,      :COL4        
    ,BLOB('000001')    
 


Please help me how to get an entry in this table with some value for BLOB?
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: HOW TO INSERT SOME DUMMY VALUE TO BLOB FIELD

Postby hariharan_bk » Wed Jun 08, 2016 3:40 pm



01  WS-IN-BLOB USAGE IS SQL TYPE IS BLOB(1048576).      <--- declared this WS variable.... internnaly this is handled as VARCHAR..... so we need to pass actual length and data to the variables as shown below....
....

MOVE 10                      TO WS-IN-BLOB-LENGTH
MOVE 'DUMMY DATA'                                
                             TO WS-IN-BLOB-DATA  
....

INSERT INTO DATA_BLOB_DUMMY      
     (                            
       COL1, COL2, COL3, COL4              
      , BLOB_FIELD                
     )                            
VALUES                            
     (                            
      :COL1
,      :COL2
,      :COL3
,      :COL4        
,      :WS-IN-BLOB    <-------
  )            


 



this worked, Thanks
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post