IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to Compile a Cobol Program using REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 03, 2009 12:23 pm
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: 400
Location: Mumbai

PostPosted: Tue Mar 03, 2009 12:23 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top