Solved

CFExecute Stalls

Posted on 2004-09-30
21
1,645 Views
Last Modified: 2013-12-24
We are migrating some scripts that run on the Cold Fusion scheduler but the scripts that use the AS400 upload command have issues. The CFM code that is being called in the scheduler is:

<CFEXECUTE NAME="C:\inetpub\Batch\as400.bat"
ARGUMENTS="-e"
    OUTPUTFILE="C:\Temp\output.txt"
    TIMEOUT="100">
</CFEXECUTE>

as400.bat is the following:

cd c:\
rfrompcb C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr

Note running this .bat file works perfectly.

When I run the CFM file it usually stalls for a long time. I see the process "rfrompcb" running in the background and the only way to fix the stalling is to terminate the process. Usually before I do this, "output.txt" cannot be opened. After I cancel this process, the txt file shows:


C:\CFusionMX\runtime\bin>echo off

IBM AS/400 Client Access Express for Windows
Version 5  Release 1  Level 0
Transfer data to AS/400
(C) Copyright IBM Corporation and Others 1984, 2000.  All rights reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure
  restricted by GSA ADP Schedule Contract with IBM Corp.
Licensed Materials - Property of IBM

Note if it DID work it should append "Send Successful" to the end.

I am really baffled by this and Ive tried various things including using the 3rd part cfx_exec component and setting the IUSR_compname in the permissions in dcomcnfg.
0
Comment
Question by:jingaling
  • 10
  • 10
21 Comments
 
LVL 17

Expert Comment

by:Tacobell777
ID: 12196098
Why is there a cd c:\
change directory to c:\
when the full path already includes the drive?

Could have nothing to do with it, but......

have you tried

<CFEXECUTE NAME="#fullPathHereIfNotInSystem32#rfrompcb"
ARGUMENTS="C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr"
    OUTPUTFILE="C:\Temp\output.txt"
    TIMEOUT="100">
</CFEXECUTE>
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12196765
If you have CFX_EXEC, try the following:

<CFX_EXEC CMD="cmd.exe /c rfrompcb C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr" DIR="C:\" TIMEOUT="100000" NAME="OUT">
<cfoutput>#OUT#</cfoutput>

Also you may try to add INTERACTIVE="Y" to see what happens in DOS prompt window.  If batch works, this must work.
For debugging purposes, you may want to move trf file to a directory, which is 100% guaranteed accessible for CF process.

0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12196859
Also.  From IBM manual:

Client Access provides a batch data transfer function in the form of the RTOPCB and RFROMPCB console programs. The Client Access batch data transfer programs allow unattended data transfer and can be used in DOS-style batch programs. The batch data transfer is useful for moving data files between OS/400 and a Windows PC. However, there are situations where batch data transfer may be difficult or impractical to use. These situations include:

o Unattended environments. With the exception of Client Access Express V5R1 or later, the batch data transfer functions do not allow users to specify the user profile or password to be used on the connection. This makes it very difficult to run the programs in an unattended environment such as a Windows service program.  

o Synchronization with the transfer. The batch transfer is run in a separate process on the PC. There may be situations where an OS/400 user must control transfers from the OS/400 side or where the additional processing on the transferred file is required. Synchronizing with a separate process adds increased complexity.  

o Robust error handling. The batch programs signal error severities similar to the old DOS commands. There may be times when better error handling is required
. . . .

It looks like you need a proper login.  Add user login to CFX_EXEC call.
0
 

Author Comment

by:jingaling
ID: 12201139
<CFX_EXEC CMD="cmd.exe /c rfrompcb C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr" DIR="C:\" TIMEOUT="100000" NAME="OUT">
<cfoutput>#OUT#</cfoutput>

AND

<CFEXECUTE NAME="#fullPathHereIfNotInSystem32#rfrompcb"
ARGUMENTS="C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr"
    OUTPUTFILE="C:\Temp\output.txt"
    TIMEOUT="100">
</CFEXECUTE>

Did not work. It produced this result in the browser:

IBM AS/400 Client Access Express for Windows Version 5 Release 1 Level 0 Transfer data to AS/400 (C) Copyright IBM Corporation and Others 1984, 2000. All rights reserved. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Licensed Materials - Property of IBM

Using a lower timeout value (100) it produced a timeout:

Timeout period expired without completion of rfrompcb  
 
The error occurred in C:\Inetpub\IntranetRoot\asmwkst\as400upload.cfm: line 19
 
17 : <CFEXECUTE NAME="rfrompcb"
18 : ARGUMENTS="C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr"
19 :     OUTPUTFILE="C:\Temp\output.txt"
20 :     TIMEOUT="100">
21 : </CFEXECUTE>

But notice it has no "send completed" note plus the rfrompcb.exe process was still in task manager (it doesnt take that long to do). It did prompt for user name and password, but in Cold Fusion Scheduler I can put that in too.

This worked in our old machine by having IBM CLient Access open with the connections to the IBM servers. I replicated the same thing here but for some reason it doesnt work. Let me emphasize that typing the command or executing the batch works, so the authentication on the IBM side works. Something about the CFexecute is causing the problems, specifically the fact that we are running CFMX instead of CF 4.5 on the old machine.
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12201853
So, you wanna say that when you execute this program interactively, you are prompted for password?  How authentication works?

0
 

Author Comment

by:jingaling
ID: 12202061
When I run it in CF scheduler, it uses the username/pw I provide which is OK. When I run it by the code itself, it prompts (this is because the file is NT authenticated). IBM Client Access has to also be up, with the connections established (done).

I suspect since it is only with CF that this gets reamed, its with the permissions or the server user that is running it. E.g. when I manually run the process its OK, but for some reason when CF runs it, it stalls and hangs in the server processes.
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12202132
If this is a permission problem, did you try CFX_EXEC with authentication parameters?  Provide the same account you are logged, as a user when you run batch manually.  Also, there are some switches for rfrompcb, like /S.  It might give a clue why it doesn't work (cannot read file, cannot make connection....)
0
 

Author Comment

by:jingaling
ID: 12202382
I tried this

<CFX_EXEC CMD="cmd.exe /c rfrompcb /S C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr" DIR="C:\" TIMEOUT="100000" USER="user" PWD="password" DOMAIN="domain" FILE="c:\temp\output.txt">

Strange thing is output.txt shows nothing. It seems to run, rfrompcb doesnt get stuck in the task manager, but its disconcerting that nothing comes up in the output.txt file. I am checking now to see if the actual transfer still took place.
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12203124
It also may mean that completely nothing happened.  You have to check for "STATUS" after CFX_EXEC exits:

<CFIF STATUS NEQ "OK">
     <CFOUTPUT>#MSG#</CFOUTPUT><BR>
     Error number: <CFOUTPUT>#ERRN#</CFOUTPUT>
</CFIF>
0
 

Author Comment

by:jingaling
ID: 12203151
I checked our AS400 and it did not work. I added that code but again, the browser spit absolutely nothing out, just a blank page.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:jingaling
ID: 12203256
Messing around with Username, Password, and Domain I finally at least got a error message:

Logon failure: unknown user name or bad password.
Error number: 1326

I dont know what is generating that, rfrompcb or ColdFusion. If so, Im not sure which User/name/domain to put???
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12203285
Add to see if CFX_EXEC worked at all:

<CFIF STATUS NEQ "OK">
     <CFOUTPUT>#MSG#</CFOUTPUT><BR>
     Error number: <CFOUTPUT>#ERRN#</CFOUTPUT>
<CFELSE>
   Execution time: <cfoutput>#EXECTIME#</cfoutput> ms
</CFIF>

Also try to remove that /S switch from command line.  See if it makes any difference.

If not, remove /c from command line and add INTEARCTIVE="Y" in CFX_EXEC param list.  This will make DOS prompt window visible and it will stay after command completes.  Might give some clues...
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12203298
This error comes from CFX_EXEC.  Use login that works when you run batch manually and it works.
0
 

Author Comment

by:jingaling
ID: 12218225
I tried the above tips. With the "CMD" tag, I see "Execution Time: 0MS" which is not good. When I modify it to just "rfrompcb ....." instead of "cmd.exe /c rfrompcb" I see "Execution Time: 32MS". The interactive tag on doesnt make anything different, just makes the MS go back to 0.

The data is still not uploaded to the AS400 and the output.txt file is still stuck with no data. At least the rfrompcb process doesnt get stuck in the process list..
0
 

Author Comment

by:jingaling
ID: 12221990
FYI I have been conversing with IBM on the phone and they suspect it is something to do with Win 2003 permissions to server processes. Instead of using rfrompcb, I am using rxferpcb which allows you to put a user name and password (to the AS400 system). Unfortunately for some reason it still produces some sort of error, presumably due to an inabilty to access the data file(?) when run as part of a ColdFusion process. Anyone got experience with anything similar?
0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12222666
If you use login in CFX_EXEC that allows to acces the file, it must work.  Don't use batc file, don't use cmd.exe.  Run process (rxferpcb) directly.  If an account is defined in CFX_EXEC, task runs under specified account.  If INERACTIVE flag is specified, task runs on the interactive desktop (not in services desktop).  There is no reasons why it shouldn't work.
0
 

Author Comment

by:jingaling
ID: 12222864
Still no luck. Here is the cfm code Im trying to run

<CFX_EXEC CMD="rxferpcb.exe C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr clienta1 password" DIR="C:\Program Files\IBM\Client Access\" USER="administrator" PWD="****" DOMAIN="localmachine" TIMEOUT="100000" FILE="c:\temp\output3.txt">
<CFIF STATUS NEQ "OK">
     <CFOUTPUT>#MSG#</CFOUTPUT><BR>
     Error number: <CFOUTPUT>#ERRN#</CFOUTPUT>
<CFELSE>
   Execution time: <cfoutput>#EXECTIME#</cfoutput> ms
</CFIF>

Using CFX Execute it just doesnt do anything. Had better luck with CF_execute, at least it let it generate output.
0
 
LVL 7

Accepted Solution

by:
INSDivision6 earned 500 total points
ID: 12223524
You should get error on this.  If you not, something is wrong in your code.  If you are logging on local account, DOMAIN has to be ".", not "localmachine".  Also you don't need to bother with the FILE, use:

<CFX_EXEC CMD="rxferpcb.exe C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr clienta1 password" DIR="C:\Program Files\IBM\Client Access\" USER="administrator" PWD="****" DOMAIN="." TIMEOUT="100000" NAME="OUT">
<CFIF STATUS NEQ "OK">
     <CFOUTPUT>#MSG#</CFOUTPUT><BR>
     Error number: <CFOUTPUT>#ERRN#</CFOUTPUT>
<CFELSE>
   Execution time: <cfoutput>#EXECTIME#</cfoutput> ms
   <br>
   Exit code: <cfoutput>#EXITCODE#</cfoutput>
   <br>
  <pre><cfoutput>#OUT#</cfoutput></pre>
</CFIF>

If no error is produced and no output is produced, the program doesn't do antyhing (dies before it outputs).  Does this line work in DOS prompt?
0
 

Author Comment

by:jingaling
ID: 12228800
I had to reinstall Client Access and I upgraded the service pack. New error:

Execution time: 203 ms
Exit code: 20

IBM iSeries Access for Windows
Version 5  Release 2  Level 0
RXFERPCB
(C) Copyright IBM Corporation and Others 1984, 2002.  All rights reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure
  restricted by GSA ADP Schedule Contract with IBM Corp.
Licensed Materials - Property of IBM

Transfer request C:\inetpub\intranetroot\asmwkst\Batch\f550157.tfr FAILED.


Client Access Error Messages:

CWBCO1011 - Remote port could not be resolved

   Elasped transfer time: 0 hours 0 minutes 0.63 seconds (63 ms)
   CompletionTime          = 2004-10-5 10.5.52.0
   Rows Transferred        = 0
   Data Warnings Occurred  = No
   Data Errors Occurred  = No

0
 
LVL 7

Expert Comment

by:INSDivision6
ID: 12228945
So, definitely it's working now.  "Remote port could not be resolved"...  Hmmm...  I would guess AS/400 is not listening on the port specified.  Is it configurable?  Better to search IBM docs.
0
 

Author Comment

by:jingaling
ID: 12238591
This doesnt seem like an issue that can be resolved, so I am going to close the ticket. Thanks for everyone's input, it helped diagnose the problem. Unfortunately I think its something that even IBM cannot figure out.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now