Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set a MS Access Table into CobolArray

Status
Not open for further replies.

ilMag

Programmer
May 8, 2005
2
BE
Code:
exec sql declare cursor1
       cursor for
           select number, name
            from TestVraag
           where  gender = :gender
       end-exec
       display SQLcode
       display sqlstate

//result can be multiple rows

       exec sql open cursor1 end-exec

       perform sizeTable times
         exec sql fetch cursor1
             into indexTableRow (:number, :gender)
         end-exec

       end-perform

       exec sql close cursor1 end-exec

this is just simple example of how i think it would work but it doesn't, anyone wan't to help here?
the name of the destinationarray is 'table1' but i don't know where to put it
thx in advance
 
see thread209-1051689 for links to examples.

Just as a minor note on your code, you do not preform the fetch like that.

You do the fech until the sql return code is "no more records".

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Update on how to import a database table into a cobol table
i corrected the fetch but there's still something wrong
need some help
thx for the post 'fredericofonseca'.

Code:
        exec sql declare cursor1
            cursor for
            select name,gender
             from aTable
            where  gender = :gender
        end-exec
        
        exec sql open cursor1 end-exec
        
        move 0 to counter3
        perform fillingTable until sqlstate = "02000"
        
        exec sql close cursor1 end-exec
        exec sql commit end-exec
       
 fillingTable.       
       exec sql fetch cursor1   
           into :name2, :gender2         
        end-exec
       
       if sqlstate not = "02000"
                set tableIndex to counter3
                move name2 to name(tableIndex)
                move gender2 to gender(tableIndex)
                add 1 to counter3
       end-if.
 
You need to give us the FULL code, not just that bit, and you also need to give us the error you are getting, and if no error you need to tell us WHY you think it is wrong.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top