Solved

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

Posted on 2004-09-15
10
904 Views
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


Code:
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.
0
Comment
Question by:gummylick
[X]
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
10 Comments
 
LVL 14

Expert Comment

by:daveslater
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(?,?,?,?,?,?,?)}}"

Dave
0
 
LVL 14

Expert Comment

by:daveslater
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(?,?,?,?,?,?,?)}}"
0
 

Author Comment

by:gummylick
ID: 12076741
Thanks for your suggestion, dave.  I removed the "/" before "/QSYS.LIB" but continue to get the same error.  Thanks for your help.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:gummylick
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>.
0
 
LVL 33

Expert Comment

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

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

ShalomC
0
 
LVL 13

Expert Comment

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

Expert Comment

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

0
 

Author Comment

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

Accepted Solution

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

modulo
Community Support Moderator
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
cwbx.dll not working on 64-bit 6 2,290
AS400 Printer emulation Print to PDF 5 1,000
Jobs on iSeries autoanswer by itselfs. 10 174
iSeries Bath SFTP CL Program Problem 6 504
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 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