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

RPGLE or /Free (URL Call)

Status
Not open for further replies.

Oche

Programmer
Sep 14, 2007
11
US
Is there a way to call up a URL directly from RPGLE or /free?
 
Yes, you need to write a CL program:

Code:
             PGM        PARM(&WEBSITE)                                 
             DCL        VAR(&CALL) TYPE(*CHAR) LEN(123) VALUE(' ')     
             DCL        VAR(&WEBSITE) TYPE(*CHAR) LEN(89)              
             STRPCO                                                    
             MONMSG     MSGID(CPF0000 IWS0000)                         
             CHGVAR     VAR(&CALL) VALUE('rundll32 +                   
                          url.dll,FileProtocolHandler' *BCAT &WEBSITE) 
             STRPCCMD   PCCMD(&CALL) PAUSE(*NO)                        
             MONMSG     MSGID(CPF0000)                                 
             ENDPGM

Then call the program from your RPG with the URL you want to open.


-- Francis
I'd like to change the world, but I can't find the source code.
 
First....thank you.

I put in the below to test the CL. I am receiving the following error:
Error in URL.DLL
Missing entry: FILEPROTOCOLHANDLER

Any ideas?

Code:
PGM                                                       
DCL        VAR(&CALL) TYPE(*CHAR) LEN(123) VALUE(' ')     
DCL        VAR(&WEBSITE) TYPE(*CHAR) LEN(89) +            
             VALUE('[URL unfurl="true"]HTTP://WWW.YAHOO.COM')[/URL]                
STRPCO                                                    
MONMSG     MSGID(CPF0000 IWS0000)                         
CHGVAR     VAR(&CALL) VALUE('RUNDLL32 +                   
             URL.DLL,FILEPROTOCOLHANDLER' *BCAT &WEBSITE) 
STRPCCMD   PCCMD(&CALL) PAUSE(*NO)                        
MONMSG     MSGID(CPF0000)                                 
ENDPGM
 
Case matters for the command in quotes. The AS/400 is not case-sensitve, but Windows is.

Also, I copied the wrong code - my mistake.

This one works:

Code:
             PGM        PARM(&WEBSITE)                             
             DCL        VAR(&CALL) TYPE(*CHAR) LEN(123) VALUE(' ') 
             DCL        VAR(&WEBSITE) TYPE(*CHAR) LEN(117)         
             STRPCO     PCTA(*NO)                                  
             MONMSG     MSGID(IWS4010)                             
             CHGVAR     VAR(&CALL) VALUE('start' *BCAT &WEBSITE)   
             STRPCCMD   PCCMD(&CALL) PAUSE(*NO)                    
             MONMSG     MSGID(CPF0000)                             
             ENDPGM

If I compile it and call it like this:

Code:
CALL PGM(FMLLIB/RUNWEB) PARM('[URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1565565')[/URL]

then I get this web page.

-- Francis
I'd like to change the world, but I can't find the source code.
 
Aso, in SEU, type SET CAPS OFF so that when you paste the code, it won't force it to upper case.

-- Francis
I'd like to change the world, but I can't find the source code.
 
Perfect..thank you!!!

One more quick question, does this only work with Client Access? Our overseas manufacturers use MochaSoft.

 
It doesn't matter what your emulator is. Client Access is not required. I'm using Rumba here. Just to be safe, make sure the other system has the STRPCO command.

-- Francis
I'd like to change the world, but I can't find the source code.
 
Not sure that STRPCCMD works under Mosha ... even if PCO.exe (STRCPO) is installed and started on the Windows side (I am in doubt.)
Also
Code:
CHGVAR     VAR(&CALL) VALUE('rundll32 url.dll,FileProtocolHandler' *BCAT &WEBSITE)
STRPCCMD   PCCMD(&CALL) PAUSE(*NO)

should work though.
 
Mercury,

It didn't work for me (using the example I first posted), which is why I also posted the second one using PCO.

-- Francis
I'd like to change the world, but I can't find the source code.
 
Oche said:
does this only work with Client Access?
flapeyre said:
It doesn't matter what your emulator is. Client Access is not required.
I tried it on a PC where I have only tn5250 and no iSeries Navigator installed and it doesn't work.
I got an error:
Code:
Required PC program (PCO.EXE) is not active 
No communications with PC can occur
 
To All,

Well if you do not use Client Access STRPCO/STRPCCMD won't work.

Look here.

Side note -- This forum is among the worst to edit posts.


Philippe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top