Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
REXX executes the COBOL program in a loop

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
sasanka

New User


Joined: 18 Jan 2008
Posts: 5
Location: chennai

PostPosted: Fri Apr 18, 2008 3:56 pm    Post subject: REXX executes the COBOL program in a loop
Reply with quote

Hi,

I wrote a REXX program which read record from a file and provide this record as an input to a COBOL program at run time and that COBOL program write that record to the output file and the REXX executes the COBOL program in a loop until the end of the file is reached.

COBOL CODE is given below :
Code:

IDENTIFICATION DIVISION.               
PROGRAM-ID.    PGM1.                   
                                       
ENVIRONMENT DIVISION.                   
                                       
CONFIGURATION SECTION.                 
INPUT-OUTPUT SECTION.                   
FILE-CONTROL.                           
     SELECT OUT-FILE                   
            ASSIGN TO OUTFILE.         
DATA DIVISION.                         
FILE SECTION.                           
FD OUT-FILE.                           
01  OUT-REC             PIC 9(04).     
WORKING-STORAGE SECTION.               
01 NUM1         PIC 9(3).   
01 NUM2         PIC 9(3).                 
PROCEDURE DIVISION.               
     ACCEPT NUM1
     ACCEPT NUM2
     OUT-REC = NUM1 + NUM2                 
     WRITE OUT-REC                 
     DISPLAY 'NUMBER : ' OUT-REC       
     GOBACK.                         

REXX CODE is given below :
Code:

/*REXX  PROGRAM TO EXECUTE A COBOL PROGRAM IN LOOP*/
"EXECIO * DISKR MYINDD1 (STEM LINE1. FINIS"
"EXECIO * DISKR MYINDD2 (STEM LINE2. FINIS"                             
                             
DO I = 1 TO LINE1.0  AND  J=1 TO LINE2.0
  "//JOBLIB   DD DSN=HFH1.EN@IDEV.HFH.BATCH.LOADLIB.Y2K,DISP=SHR"       
  "//STEP01      EXEC PGM=PGM1"                                         
  "//SYSIN    DD*"                                                       
  "  LINE1.I "
  "  LINE1.J "                                                           
  "/*"                                                                   
  "//OUTFILE  DD   DSN=A333.FILE.REXXOUT,DISP=SHR"                       
  "//SYSPRINT DD SYSOUT=*"                                               
  "//SYSOUT   DD SYSOUT=*"                                               
END                                                                   
                                                                       
EXIT                     


The JCL executing the REXX program is

Code:
                     
//STEP01    EXEC PGM=IKJEFT01                           
//SYSTSPRT  DD SYSOUT=*                                 
//MYINDD1    DD DSN=A333.FILE.REXX1,DISP=SHR
//MYINDD2    DD DSN=A333.FILE.REXX2,DISP=SHR                           
//SYSTSIN   DD *                                       
  EX 'A333.REXX.TEST(REXXPGM1)'                         
/*                                                     
//SYSOUT    DD SYSOUT=*                                 


The contents of input file A333.FILE.REXX1 is:

123
567
003

The contents of input file A333.FILE.REXX2 is:

234
667
440

The output file name is A333.FILE.REXXOUT.

My program executed successfully, but the output file becomes empty.

Thanks,
Sasanka
Back to top
View user's profile Send private message
References
PostPosted: Fri Apr 18, 2008 3:56 pm    Post subject: Re: REXX executes the COBOL program in a loop Reply with quote

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 2523
Location: Brussels once more ...

PostPosted: Fri Apr 18, 2008 4:46 pm    Post subject:
Reply with quote

So where is the COBOL program executed ?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3008
Location: Charlotte,NC USA

PostPosted: Fri Apr 18, 2008 4:48 pm    Post subject: Reply to: REXX executes the COBOL program in a loop
Reply with quote

The REXX code is syntactically incorrect, and doesn't do anything. What are you really trying to accomplish here?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 2523
Location: Brussels once more ...

PostPosted: Fri Apr 18, 2008 4:49 pm    Post subject:
Reply with quote

Yeah, why not just run the COBOL program with the input ?
Back to top
View user's profile Send private message
karthikraman_m

New User


Joined: 10 Jun 2005
Posts: 14
Location: India

PostPosted: Tue Apr 22, 2008 9:39 pm    Post subject:
Reply with quote

Hi Sasanka,

You are trying a situation of JCL calling Rexx and this Rexx inturn submitting a Job with a Cobol program ????? Nice Experiment :-)

Anyhow, the Rexx program only contains the JCL steps in a Do loop......It does not submit your job. Check that !!! You need to submit the job to get it executing the COBOL program.

Thanks,
Karthik Raman
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1