Calling a Program, Passing Parms from ASP to AS/400

Posted on 2004-09-15
Last Modified: 2008-01-09
I'm trying to call a program on our AS/400 and repeatedly get this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0104 - Token / was not valid. Valid tokens: : <IDENTIFIER>.

On this line: cmd400.EXECUTE parms,adcmdtxt

Set cmd400 = Server.CreateObject("ADODB.Command")
Set cmd400.activeConnection = AS400
cmd400.CommandType = adCmdText

cmd400.CommandText = "{{CALL /QSYS.LIB/W2.LIB/W1LI.PGM(?,?,?,?,?,?,?)}}"
cmd400.Prepared = True

cmd400.Parameters.Append cmd400.CreateParameter("PSessid", adDecimal, adParamInput)
cmd400.Parameters(0).Precision = 10
cmd400.Parameters(0).NumericScale = 0

cmd400.Parameters.Append cmd400.CreateParameter("PUser", adChar, adParamInput,15)

cmd400.Parameters.Append cmd400.CreateParameter("PCusnr", adDecimal, adParamInput)
cmd400.Parameters(2).Precision = 6
cmd400.Parameters(2).NumericScale = 0

cmd400.Parameters.Append cmd400.CreateParameter("PCpwd", adChar, adParamInput,25)

cmd400.Parameters.Append cmd400.CreateParameter("PIPAdd", adchar, adParamInput,15)

cmd400.Parameters.Append cmd400.CreateParameter("PInout", adDecimal, adParamInput)
cmd400.Parameters(5).Precision = 1
cmd400.Parameters(5).NumericScale = 0

cmd400.Parameters.Append cmd400.CreateParameter("PSuccess", adchar, adParamOutput,1)

psessid = session.sessionid
puser = uid
pcusnr = cnbr
pcpwd = pwd
pipadd = Request.ServerVariables("Remote_addr")
pinout = 1
parms = array(psessid,puser,pcusnr,pcpwd,pipadd,pinout,psuccess)

cmd400.EXECUTE parms,adcmdtxt

Thanks for your assistance.
Question by:gummylick
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
LVL 14

Expert Comment

ID: 12072663
Hi the way I have done it in VB is
AS400Pgm.CommandText = "{{call DSLIB/PGM1(?)}}"
so you could try
cmd400.CommandText = "{{CALL W2.LIB/W1LI.PGM(?,?,?,?,?,?,?)}}"

LVL 14

Expert Comment

ID: 12073906
I do not think you need the first / as the defualt is the root directory

cmd400.CommandText = "{{CALL QSYS.LIB/W2.LIB/W1LI.PGM(?,?,?,?,?,?,?)}}"

Author Comment

ID: 12076741
Thanks for your suggestion, dave.  I removed the "/" before "/QSYS.LIB" but continue to get the same error.  Thanks for your help.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Author Comment

ID: 12076757
When I remove "/QSYSLIB/"  I get:  

[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0104 - Token / was not valid. Valid tokens: <END-OF-STATEMENT>.
LVL 33

Expert Comment

ID: 12079691
try either
cmd400.CommandText = "{{CALL W2/W1LI (?,?,?,?,?,?,?)}}"

cmd400.CommandText = "{{CALL W2.W1LI (?,?,?,?,?,?,?)}}"

LVL 13

Expert Comment

ID: 12101347
Did you put the program on the AS400 as a stored procedure?
LVL 13

Expert Comment

ID: 12101356
Program has to be registered as a stored procedure to handle the parameters.


Author Comment

ID: 12373887
I ended up using a work around. :(.

Accepted Solution

modulo earned 0 total points
ID: 12512398
PAQed, with points refunded (300)

Community Support Moderator

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here's how to start interacting with our community through Post.
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question