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

Compile a COBOL program in rexx


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 9:31 am
Reply with quote

Can i compile a cobol program in rexx ??

i have a cobol program which writes out some records to output file. The layout of the output file is dynamically changed, so every time i need to change the output layout, recompile the cobol program and run.

Can this be done using rexx which will

- Ask user for input and output lay out
- Update cobol program with the desired changes
- Compile cobol program
- Run and generate output file in new format ???

Apart from compilations, other things are managable, i know. But can i compile cobol program is REXX ???

Can this be done .....
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat Dec 13, 2008 9:48 am
Reply with quote

The compiler and link editor are just programs that can be called. Don't you normally call them to compile your programs anyway?
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 11:41 am
Reply with quote

Yes ........... but as far as i remember, we use to call one utility IJK**** something .... for cobol compile and link edit. I am searching for that utility.
Will that be installation dependant ,where can i search?
Or there are default compilers provided with installations ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 11:50 am
Reply with quote

Hello,

Quote:
Or there are default compilers provided with installations ?
Every site i've supported has standard compile/link jcl for the enfironment. This standard jcl is completely site-specific, but it does the normal compile processes (like precompilers, comiplers, link-edit, bind as needed and so forth).

Also, none of these sites allows online cobol compiles. All are run in batch to take that load off of the tso environment.
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 12:02 pm
Reply with quote

I was searching for compilers and found some utilities like
IGYCRCTL/CWPCMAIN .... IEWBLINK/IEWL

I would check anything of these (or something else) are available in my shop, but

Quote:

All are run in batch to take that load off of the tso environment


the question is can i call these in rexx direct in to my rexx or i will need some work around, like may be submitting JCL thru' my rexx.
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 12:04 pm
Reply with quote

Quote:
the question is can i call these in rexx direct in to my rexx or i will need some work around, like may be submitting JCL thru' my rexx.

Sorry for typo ...

the question is, can i call these programs(compilers) directly in to my rexx or i will need some work around, like may be submitting JCL thru' my rexx.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 13, 2008 12:14 pm
Reply with quote

Hello,

I've heard of places that support online compiles, but am not knowledgable of the secifics of what they use.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:17 pm
Reply with quote

hsk,

How about submitting a job from REXX with compile/link edit steps followed by the run step.
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 4:23 pm
Reply with quote

Hi Arun,

Yes, that's the option i see but have few doubts

1. It will no more 'User interactive', user has to go to spool and check for results or would need to browse the output file manually.
I know i can run rexx from JCL also but i doubt if it can bring me back to interactive mode from batch.

2. can we have compile and run steps in the same JCL , not sure if there would be any SHR issue and updated load module will be available in next step?
or i need two different JCL's
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Dec 13, 2008 4:27 pm
Reply with quote

What do you want to do after the successful execution of the job?

You can access the updated load module in your final step.
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 4:49 pm
Reply with quote

arcvns wrote:
What do you want to do after the successful execution of the job?



What i am thinking to do is
- ask user for input/out layouts and input file .
- Change cobol program according to layout
- compile cobol
- run cobol and prepare output file
- open file ..... browse file .... (ISPEXEC VIEW/BROWSE something) ..... about this i doubt if it would be possible
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Dec 13, 2008 5:41 pm
Reply with quote

I'd go with Arun and submit a batch job. Otherwise you could lock the terminal for a long time.

The job can notify the user that the job has completed, so then browsing the file is just a formality.
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Sat Dec 13, 2008 7:16 pm
Reply with quote

Thank you guys, for your suggessions that helped a lot ...........

let me see how it works out !!!

Thanks !!!!!
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Sun Dec 14, 2008 6:35 am
Reply with quote

Superk's original point was that you can call any program from rexx the same way you call it from JCL. Allocate dd names and call the program. That is all that JCL does! I think there is a general frustration that the answer to questions about running programs always seems to involve running a batch job. That is almost never necessary for an online program to do!

Just look at some compile JCL. Replicate those DD statements in the Rexx program by using TSO allocate statements. Call the compiler using a TSO call statement (not Rexx Call). Roughly (yours will be different!!):
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
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Dec 14, 2008 7:25 am
Reply with quote

Hello,

Most organizations have standard compile/link jcl and to use something else is grounds for a reprimand and in some cases dismissal. There simply cannot be a separate way to compile for every developer that has an idea. The standards are for quality and consistency and to minimize the amount of modification needed when some environmental change is made.

hsk,
I strongly urge that if you intend to try this you get permission in writing or at least an e-mail from management that is it permissable to use other than your system standard.


fwiw - in the last 20+ years i have been involved with more than 100 mainframes for over 30 clients. None of these permits online compiles of cobol code by the development staff. They do not want the extra overhead in tso. Also, they have had standards in place for many years and as we know - change does not come easily icon_smile.gif

On the forum here, there have been very few people who have posted that their cobol programmers compile online.

As more an more "mainframers" come with pc background (where there isn't much "real" batch), online compiles will possibly become more common even if it costs more machine. Use of Change/Configuration Management (CM) software like Endevor and ChangeMan may have an impact as well. It should be interesting. . .
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Sun Dec 14, 2008 9:11 am
Reply with quote

Dick is absolutely right that most shops don't want compiles of code destined for production to be compiled in foreground or through unapproved methods. If you are new to the shop, understand their procedures before writing your own tools.

Having said that, there are many reasons for a programmer to invoke programs, including compilers, in foreground. These may be syntax checking tools, code analysis, test and report preparation, code formatting, third party tool integration, programmer education, various edit macro uses such as content assist, and others, many of which don't even generate object code. I won't judge the validity of the original question. I've worked in shops where almost everything is done in foreground because the system is dedicated to development and the source code managers have online functions. A well tuned system will throw long running TSO transactions into low priority anyway.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Dec 14, 2008 9:36 am
Reply with quote

Quote:
Having said that, there are many reasons for a programmer to invoke programs, including compilers, in foreground. These may be syntax checking tools, code analysis, test and report preparation, code formatting, third party tool integration, programmer education, various edit macro uses such as content assist, and others, many of which don't even generate object code.
Yes, i surely agree icon_cool.gif

d
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Dec 14, 2008 9:24 pm
Reply with quote

At our site, I use this method to check some copybooks:
Once the copy has been envelopped with the minimum cobol divisions and sections,
I run a small compilation:
Code:
Address TSO
"ALLOC F(SYSUT1) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT2) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT3) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT4) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT5) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT6) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"
"ALLOC F(SYSUT7) NEW SPACE(5,5) TRACKS UNIT(SYSDA) REUSE"

Parm = "'NOMAP,NOLIST,NOCOMPILE(W),NOOBJECT,NOOFFSET,NOVBREF,NOXREF,FLAG(I,I),NOOPT'"                                 

"CALL 'SYS1.SIGYCOMP(IGYCRCTL)'" Parm
In this example, the options are chosen so I need only check the return code,
but these options are easily changed (and certainly require more ALLOC lines).
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Sun Dec 14, 2008 10:23 pm
Reply with quote

Our site allows either online compile or batch. If the compiles take too long, the person will only do it a few times then learn to use batch.

During development, the developer compiles numerous times, sometimes using private libraries and other parts still under development. It would be difficult to have a 'standard compile'.

But when the code is checked into the library system and for production use, it can only be compiled by the librarian.
Back to top
View user's profile Send private message
Arun Kumar S

New User


Joined: 23 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Tue Jan 27, 2009 11:58 am
Reply with quote

Hi,

I have the below rexx macro to compile a cobol program.

Code:

/* REXX */
ADDRESS ISREDIT MACRO
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
"ISREDIT (SRCL) =  DATASET"
"ISREDIT (MEMB) =  MEMBER"
MESSAGE_SETTING = MSG("OFF")
DSNX = SRCL
MEMX = MEMB
USRID = USERID()
SYSPRINTDSN = DYD.PERM.|| USRID ||.SYSPRINT
SYSOUTDSN = DYD.PERM.|| USRID ||.SYSOUT
ADDRESS TSO
"FREE F(SYSPRINT SYSIN SYSLIN SYSUT1 SYSUT2 SYSUT3 SYSUT4",
       "SYSUT5 SYSUT6 SYSUT7 SYSLIB SYSOUT)"
"ALLOC F(SYSPRINT) DA('"SYSPRINTDSN"') OLD REUSE"
"ALLOC F(SYSIN) DA('"DSNX"("MEMX")') SHR REUSE"
"ALLOC F(SYSLIN) DA('DYD.PERM.INFY.LOAD("MEMX")') OLD REUSE"
"ALLOC F(SYSLMOD) DA('DYD.PERM.INFY.LOAD("MEMX")') OLD REUSE"
"ALLOC F(SYSLIB)",
"DA('D000.COPY','D337.IC.COPY') SHR REUSE"
"ALLOC F(SYSOUT) DA('"SYSOUTDSN"') OLD REUSE"
"ALLOC F(SYSUT1) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT2) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT3) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT4) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT5) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT6) SPACE(5,5) TRACKS UNIT(SYSDA)"
"ALLOC F(SYSUT7) SPACE(5,5) TRACKS UNIT(SYSDA)"
"CALL 'IGY.SIGYCOMP(IGYCRCTL)'"
IF RC<4 THEN
   ZEDSMSG = 'COMPILATION SUCCESSFUL'
ELSE
 DO
   ZEDSMSG = 'COMPILATION FAILED RC='RC
   "ISPEXEC BROWSE DATASET('"SYSPRINTDSN"')"
   "ISPEXEC SETMSG MSG(ISRZ000)"
   RETURN
 END
/*"ALLOC F(STEPLIB) DA('D337.GRAL.EJEC') OLD REUSE"
"CALL 'SYS1.LINKLIB(IEWL)'" */
"ALLOC F(SYSLIB) DA('CEE.SCEELKED') SHR REUSE"
"CALL 'SYS1.LINKLIB(LOADER)'"
IF RC=0 THEN
 DO
   ZEDSMSG = 'COMPILE & RUN SUCCESSFUL'
   "ISPEXEC BROWSE DATASET('"SYSOUTDSN"')"
 END
ELSE
 DO
   ZEDSMSG = 'RUN FAILED RC='RC
   "ISPEXEC SETMSG MSG(ISRZ000)"
   RETURN
 END
"FREE F(SYSPRINT SYSIN SYSLIN SYSUT1 SYSUT2 SYSUT3 SYSUT4",
       "SYSUT5 SYSUT6 SYSUT7 SYSLIB SYSOUT)"
"ISPEXEC SETMSG MSG(ISRZ000)"
RETURN
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
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
Search our Forums:

Back to Top