Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Compile a Cobol Program using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sreekanth_pen
Currently Banned

New User


Joined: 16 May 2007
Posts: 4
Location: hyderabad

PostPosted: Tue Mar 03, 2009 12:02 pm    Post subject: How to Compile a Cobol Program using REXX
Reply with quote

Hi All

Eventhough Iam carrying some 8 years of experience on Mainframes behind me Iam totally new to REXX I didn't get a chance to work in REXX
in my prior shops,I had a requirement the requirement would be to build a REXX program which picks up a Cobol Source Program from a flat file
and the REXX program should compile and report all the errors in a report along with the error description just like a Cobol compiler does

Thanks a tonne to all in anticipation
Sreekanth
Back to top
View user's profile Send private message

dharmendra_kp

New User


Joined: 10 Mar 2005
Posts: 33
Location: Lewiston

PostPosted: Tue Mar 03, 2009 12:23 pm    Post subject:
Reply with quote

So basically you want to build a COBOL compiler which is written in REXX, because your new shop does not have a COBOL compiler or the licence is about to expire, is that true?

But I think you should press for getting the licence renewed instead. Otherwise this will be a futile attempt. I can understand if you want to write a program which does initial check for valid uses of COBOL keywords or a program which can display the incorrect column position per COBOL standard of the shop but would not suggest attempting to write a compiler.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 03, 2009 12:23 pm    Post subject:
Reply with quote

Well you can invoke the COBOL compiler using REXX, so why not do that.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Tue Mar 03, 2009 12:23 pm    Post subject: Reply to: How to Compile a Cobol Program using REXX
Reply with quote

The cobol compiler is just another program like any other so you can allocate the same ddnames you'd use in JCL with the ALLOC TSO command and then call the compiler (IGYCRCTL). One problem you might have is that the compiler may call other programs not in your default search sequence so look at the TSOLIB command to set that up before you enter ISPF or use the LIBDEF ISPLLIB and SELECT CMD() commands to start the compiler.

The other problem you will have is getting detailed context for errors. You can just read the listing for error text but if you want to get more sophisticated and place messages next to the source line that caused each error for example, you can have the compiler generate a SYSADATA file and have Rexx parse that. That is not simple code at all since the SYSADATA is complex but it can be done in a few 10s of lines and has been used to create edit macros and even products that show errors even in nested copybooks.
Back to top
View user's profile Send private message
sreekanth_pen
Currently Banned

New User


Joined: 16 May 2007
Posts: 4
Location: hyderabad

PostPosted: Tue Mar 03, 2009 12:38 pm    Post subject:
Reply with quote

Thank you all for your quick response Babu after doing some search in various forums available on the web I came across with this REXX script which I believe might meet my requirement I'm pasting it below
Code:

 Address TSO
 "ALLOC SHR REU F(SYSLIB) DA('"dataset"'" copybook_libraries ")
 "ALLOC NEW REU F(SYSPRINT) UNIT(VIO) DSO(PS) SP(10,10) CYL", 
   "DSO(PS) RECFM(V B) LREC(32760) BLKSIZE(0)"                 
 "ALLOC OLD REU F(SYSLIN) DUMMY REU"                           
 "ALLOC SHR REU F(SYSIN) DA('"dataset"("mem")'"               
 Do a = 1 to 7                                                 
   "ALLOC NEW REU F(SYSUT"a") UNIT(VIO) DSO(PS) SP(10,10) CYL"
 End   
Address tso "ALLOC SHR REU F(AACMLLBS) DA("compierloads")"
Address ispexec "LIBDEF ISPLLIB EXCLLIBR ID(AACMLLBS)"
tsocmd= "CALL *("compiler_load_nameb") '"compiler_parameters"'"
ispfcmd = "SELECT CMD(" || tsocmd || ')'                       
Address ispexec ispfcmd                                                       
cobrc = rc   
address ispexec "LIBDEF ISPLLIB"
"FREE F(AACMLLBS)" 
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us