Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REXX CGI - Hello World

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1647
Location: The Good Place

PostPosted: Fri Jul 13, 2018 3:53 am    Post subject: REXX CGI - Hello World
Reply with quote

Hi,

I am trying to write a sample Hello World REXX CGI script on Apache server(z/OS).
tried running,
Code:
Command ===>                                 
********************************* Top of Data *
/*rexx*/                                       
say "Content-type: text/html\n\n";             
say "Hello, World.";                           
exit                                           
******************************** Bottom of Data

By executing the URL https://server/cgi-bin/foo.rx
But got the error,
Code:
malformed header from script 'foo.rx': Bad header: Hello, World.

I tried googling "REXX CGI" and all the information on the pages just goes over my head.
I was unable to find a good tutorial for dummies.

Please help.

Vasanth.S
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8479
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 13, 2018 4:27 am    Post subject: Reply to: REXX CGI - Hello World
Reply with quote

I am by no means an expert in REXX nor CGI but try this:
Code:
/*rexx*/                                       
say "Content-type: text/html\n\n";             
say " ";
say "<h1>Hello, World.</h1>";                           
exit
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1647
Location: The Good Place

PostPosted: Fri Jul 13, 2018 9:49 pm    Post subject:
Reply with quote

Robert, Thanks for your response.
With your program, I get the below error
Code:
malformed header from script 'foo.rx': Bad header:   

Without the spaces, it was complaining about the Hello earlier

From USS, I am able to put an X(execute) infront of the script and it works ok. But when we invoke it from Web browser I get this error.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8479
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 13, 2018 9:51 pm    Post subject:
Reply with quote

Hmmmm ... try taking the SAY " "; out, then.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1647
Location: The Good Place

PostPosted: Thu Jul 19, 2018 4:24 am    Post subject:
Reply with quote

Finally got it working, I am elated :-)

The space was getting messed up in the conversion from USS file to the server.

I had to use
Say "";
instead of
Say " ";

This works
Code:
/* REXX */                   
Say 'Content-type: text/html';
Say '';                    <-- the tiny detail causing the issue.                       
Say "<h1>It works :-)</h1>";


Regards,
Vasanth.S
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can rexx be exected in cics(online) e... RAVISANKAR07 All Other Mainframe Topics 3 Wed Sep 04, 2019 5:51 pm
No new posts REXX - CLIST program to be invoked af... pkmurali CLIST & REXX 5 Wed Sep 04, 2019 4:31 pm
No new posts REXX exec (opercmd) failing quietly o... Mike.Fulton All Other Mainframe Topics 2 Sat Aug 03, 2019 4:45 am
This topic is locked: you cannot edit posts or make replies. Unable to allocate Message Library in... Learncoholic CLIST & REXX 13 Fri Jun 21, 2019 5:50 pm
No new posts Different result between normal rexx ... UmeySan CLIST & REXX 2 Tue May 07, 2019 6:18 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us