Unable to call CAI program from Rexx



IBM's Command List programming language & Restructured Extended Executor

Unable to call CAI program from Rexx

Postby Nara_513 » Wed Dec 11, 2013 7:07 pm

Hi All,

I have a JCL which i want to execute through REXX without submitting a batch job(I have the Rexx by which am able to execute the same by submitting batch job)



//CAPKSCAN EXEC PGM=PKRSCAN,REGION=1024K
//STEPLIB  DD  DSN=TECHPRD.JMR.CAILIB,DISP=SHR
//OPTIONS  DD  DSN=TECHPRD.SMR.JMR.PPOPTION(PROD#B),DISP=SHR
//SMRPRINT DD  DUMMY
//JMRPRINT DD  SYSOUT=*         /* ALL RETRIEVAL OUTPUT HERE */
//SYSUDUMP DD  SYSOUT=D         /* OPTIONAL */
//JMRIN    DD  DSN=Input Dataset



I did a search and went through couple of posts and tried the below, but got errors:

/***************************REXX**********************************/
    TRACE I
    PARM1 = '1024K'
    FILE1 = TECHPRD'.'SMR'.'JMR'.'PPOPTION
    FILE2 = XXXXX'.'JMR'.'INPUT
    FILE3 = XXXXX'.'JMR'.'OUTPUT
    "ALLOC FI(OPTIONS) DATASET('"FILE1"') SHR"
    "ALLOC FI(JMRIN) DATASET('"FILE2"') SHR"
    "ALLOC FI(JMRPRINT) DATASET('"FILE3"') SHR"
    ADDRESS TSO " CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)'"


Error that i got is :

14 *-* ADDRESS TSO " CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)'"
       >L>   " CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)'"
       +++ RC(-193) +++


Can any one let me know whether the synatx i have used is correct, if not , please correct me.

Also suggest any links regarding the same

Thanks Nara
Nara_513
 
Posts: 44
Joined: Fri Dec 02, 2011 1:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to call CAI program from Rexx

 

Re: Unable to call CAI program from Rexx

Postby NicC » Wed Dec 11, 2013 7:21 pm

Well, first of all you cannot execute a JCL (I presume you mean a job) through Rexx. You can have a Rexx submit the job. I guess you want to run a rexx exec in foreground rather than background?

You have not coded any test for successfull allocations so you do not know if the allocate statements worked. you have coded a PARM1 but not used it - and it is probably not required.
Can you actually run this program in foreground? Have you checked the documentation for it. If you can, are you calling it in the documented way?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Unable to call CAI program from Rexx

Postby Nara_513 » Wed Dec 11, 2013 8:23 pm

Yep NicC, i was able to submit a job through REXX and ran the same in back ground. I dont have a proper documentation related to this, if possible can you provide any.

Since we can call Assembler,Cobol programs from Rexx, i guess we can call this as well. Mean while am checking with Site engineers whether is it possible to call the CAI program from Rexx...

I tried to execute the coded statements and i got the error posted above.
Nara_513
 
Posts: 44
Joined: Fri Dec 02, 2011 1:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to call CAI program from Rexx

Postby Pedro » Wed Dec 11, 2013 9:07 pm

Are there any messages in the JMRPRINT file?

Typically, the called program does not care from where it was called. You normally just have to allocate the necessary files and pass the right parameters. I say 'typically' and 'normally' because someone will likely point out exceptions.

In your case you do not seem to have allocated the same as in your JCL example. The OPTIONS file is missing the member name. And by using variables, you are making it unnecessarily complicated and harder to debug.

When you do this:
   FILE1 = TECHPRD'.'SMR'.'JMR'.'PPOPTION
You are using TECHPRD as if it was a variable and you rely on one of the rules of rexx: uninitialized variables will have the value of its own name (likewise with SMR, JMR and PPOPTION). You are better off explicitly using a constant rather than a variable.

Try this:
/***************************REXX**********************************/
    TRACE I
    "ALLOC FI(OPTIONS)  DATASET('TECHPRD.SMR.JMR.PPOPTION(PROD#B)') SHR"
    "ALLOC FI(JMRIN)    DATASET('XXXXX.JMR.INPUT') SHR"
    "ALLOC FI(JMRPRINT) DATASET('XXXXX.JMR.OUTPUT') SHR"
    ADDRESS TSO "CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)'"


You may need an allocation for SMRPRINT.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: Unable to call CAI program from Rexx

Postby Nara_513 » Thu Dec 12, 2013 6:57 pm

Hi Pedro,

Am able to call the program after using the above code, but here the program is not reading the input from the JMRIN file..As a result the program is taking no input and is writing an error message to JMRPRINT file.

The JCL which i pasted at the start is a modfied one, the original JCL looks like below :
//SCAN   EXEC CAPKSCAN,OPTNLIBJ=TECHPRD.SMR.JMR.PPOPTION,
//             OPTNMEMJ=PROD#B
//JMRIN    DD *
  FUNCTION LIST=CONSTANT JOBMASK=* SDATE=13/12/11
           EDATE=13/12/11
            STRING='JOB NAME' CASE=N
//



So do i need to change the REXX code for this above JCL or can use the same ?

Thanks
Nara_513
 
Posts: 44
Joined: Fri Dec 02, 2011 1:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to call CAI program from Rexx

Postby Nara_513 » Thu Dec 12, 2013 7:16 pm

I tried running the same by commenting the JMRIN file, i got the same output, so i confirmed that my Rexx program is not reading from the JMRIN file.

Also i have used the

 /*****************************************************************/
    TRACE I
    PARM = 1056K
    PARM1 = "FUNCTION LIST=ALL JOBMASK=ARE* SDATE=13/12/10"
    "ALLOC FI(OPTIONS)  DATASET('TECHPRD.SMR.JMR.PPOPTION(PROD#B)') SHR"
 /* "ALLOC FI(JMRIN)    DATASET('A519909.JMR.INPUT2') SHR" */
    "ALLOC FI(JMRPRINT) DATASET('A519909.JMR.OUTPUT') SHR"
    "ALLOC FI(SMRPRINT) DATASET('A519909.JMR.SMRPRT') SHR"
     ADDRESS TSO "CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)'" PARM1




So do i need to pass the input as parameters ?
Nara_513
 
Posts: 44
Joined: Fri Dec 02, 2011 1:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to call CAI program from Rexx

Postby NicC » Thu Dec 12, 2013 7:22 pm

Just make sure that the control cards are in a dataset - either a flat file or as a member of a PDS and that this is allocated correctly - check the return code from ALLOC. Your code is still not checking the return codes from the allocates.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Unable to call CAI program from Rexx

Postby Nara_513 » Thu Dec 12, 2013 7:40 pm

Hi NIcC,

Sure i will inlcude the RC check after the file allocation, but am debugging right now, with TRACE option set as I, which clearly shows me the RC.

here what i observed is the output is varying based up on my call statement

When i give the PARM in my call statement:

ADDRESS TSO "CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)' 'PARM1' "


my output dataset is having :

********************************************************************************
*                JOBLOG MANAGEMENT AND RETRIEVAL - VERSION 4.6                 *
*                      DATE - THU 12 DEC 13  - INDEX USED                      *
*                           LIST ALL 'My USER ID' JOBS                            *
********************************************************************************
JMR176W ** NO DATA AVAILABLE FOR THIS RETRIEVAL ON THIS DATE




And when i remove it and call

"CALL 'TECHPRD.JMR.CAILIB(PKRSCAN)' "


I got the below in my output dataset:

JMR130W ** VALID FUNCTION KEYWORD NOT FOUND


So this clearly shows that i need to pass the input as parameter instead of file !!!!
Nara_513
 
Posts: 44
Joined: Fri Dec 02, 2011 1:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unable to call CAI program from Rexx

Postby Pedro » Thu Dec 12, 2013 10:48 pm

Your parms might work, but it is not automatic that a program would accept parms when an input file is missing. The program has to be written to do so and there is no standard for that. Perhaps you know more about the program than what you have shared with us... if so, fine, but we cannot help much.

The only 'interface' that you can rely on is that mimicking the batch interface should work in rexx. Submit your batch job and show us the entire expansion of the PKRSCAN proc:
//CAPKSCAN EXEC PGM=PKRSCAN


This:
JMR130W ** VALID FUNCTION KEYWORD NOT FOUND

is an indication of some success. You should not dismiss it altogether. The PARM1 value in your example does not match the values in the JMRIN file: perhaps you have a simple syntax error.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: Unable to call CAI program from Rexx

Postby Pedro » Thu Dec 12, 2013 11:00 pm

I meant, show us the expansion of this:
//SCAN   EXEC CAPKSCAN
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post