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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure on AS400

Status
Not open for further replies.

bytehead

Programmer
Jul 12, 2001
25
0
0
US
I am not an accomplished VB programmer by any means, so bear with me...

1. I need to open the connection to the as400 database (already accomplished).
2. I need to invoke a stored procedure (SETMAPENV) in a specific library (QGPL) and pass in two arguements (Endes, Rtnc1). The stored procedure will then return a new return code based on its accomplishments.
3. I need to invoke a stored procedure (MPXIMPPST) in a specific library (YMALIBDGRT) and pass in two arguements (TxtFil, Rtnc2). The stored procedure will then return a new return code based on its accomplishments.
4. I need to close the connection to the as400 database (already accomplished).


Below is my code from VB6, which worked wonderfully:

Sub StoreB23()
desAS400_MRP.B23.Open
Dim msg, style, title, response
If Not desAS400_MRP.B23.State = adStateOpen Then
msg = "Connection to the MRP Database(B23) was unsuccessful!" _
& vbCrLf & "Please see your system administrator!"
style = vbOKOnly + vbCritical
title = "No MRP Connection(B23)!"
response = MsgBox(msg, style, title)
'Exit Sub
End
End If

Dim Endes As String * 2
Dim Rtnc1 As String * 7
Endes = "DD"
Rtnc1 = "2"
Call desAS400_MRP.B23_QGPL_SETMAPENV(Endes, Rtnc1)
If Rtnc1 = 1 Then
msg = "Connection to the DD Environment on the MRP Database(B23) was unsuccessful!" _
& vbCrLf & "Please see your system administrator!"
style = vbOKOnly + vbCritical
title = "No Environment Connection(DD)!"
response = MsgBox(msg, style, title)
'Exit Sub
End
End If

Dim TxtFil As String * 32
Dim Rtnc2 As String * 4
TxtFil = gblUserID & "_" & frmSwitchBoard.mskEcnNum & ".txt"
Rtnc2 = "2"
Call desAS400_MRP.B23_YMALIBDGRT_MPXIMPPST(TxtFil, Rtnc2)
If Rtnc2 = 1 Then
msg = "FTP of file " & TxtFil & " was unsuccessful!" _
& vbCrLf & "Please see your system administrator!"
style = vbOKOnly + vbCritical
title = "FTP error!"
response = MsgBox(msg, style, title)
'Exit Sub
End
End If

desAS400_MRP.B23.Close
If Not desAS400_MRP.B23.State = adStateClosed Then
msg = "Connection to the MRP Database(B23) was unsuccessful closed!" _
& vbCrLf & "Please see your system administrator!"
style = vbOKOnly + vbCritical
title = "MRP Connection(B23) not closed!"
response = MsgBox(msg, style, title)
'Exit Sub
End
End If
End Sub
 
Well, have you tried to do anything yet? Were you using a Data Environment in VB 6? Have you tried creating command objects, and setting their paramaters and executing the command object?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top