Passing output to job using rexx



IBM's Command List programming language & Restructured Extended Executor

Passing output to job using rexx

Postby saikat09 » Fri Dec 20, 2013 11:53 am

I am using rexx in job and the rexx is producing one filename qualifier. I want to use this file name qualifier furher in job to produce new filename in subsequent steps. I am able to genearte the filename qualifier in rexx but don't know how to pass this output back to job so that job can use this file name qualifier furher in job to produce new filename in subsequent steps.Please advise. Below are job step and called rexx:-

Job step:-

//PS015    EXEC PGM=IKJEFT01,PARM='CDESTRFN &FNM1'
//SYSEXEC  DD DSN=THI.REXX.LIB,DISP=SHR       
//SYSTSPRT DD SYSOUT=&SOUTA                       
//SYSTSIN  DD DUMMY 


REXX:-

arg infile           
                     
call ENC_Infile_Strip
call say_messages   
exit rc             

ENC_Infile_Strip:
x=outtrap(on.)                         
x=outtrap(rec1.)                       
Address "TSO"                         
"LISTC ENT('"infile"')"               
if rc ¬= 0 then exit rc               
x=outtrap(off)                         
   do x = 1 to rec1.0                 
      if pos("NONVSAM",rec1.x) > 0     
           then do                     
             f1 = substr(rec1.x,36,15)
      end                             
end                                   
return                                 
say_messages:                             
say " "                                   
say " Filename string passed to job: "f1 
say " "                                   
return


I want to use f1 value in job to produce new filename. Please let me know how to achieve this.
saikat09
 
Posts: 5
Joined: Thu Dec 12, 2013 11:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: Passing output to job using rexx

Postby NicC » Fri Dec 20, 2013 3:07 pm

You cannot - your dataset names are defined when the job is submitted and interpreted. If you use dynamic allocation then it can be done. Your rexx (or any other language) program creates a dataset with the qualifier in it and each subsequent program then reads that dataset to get the qualifier, generates the necessary dataset name(s) and use dynamic allocation to allocate the dataset(s).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Passing output to job using rexx

Postby saikat09 » Fri Dec 20, 2013 3:33 pm

ok forget about datasetname, I think you are confused by my question. Let me simplify it. Suppose in rexx I am doing some operation and generating output. The output value is stored in f1. Now I want to pass that value back to calling job so that the value can be used for some operation. How can I achieve that. I know the f1 value can be written in some dataset and passed to job and also it can be passed to sysout. But is there any other way to pass just f1 value to calling job so that the value can be used in any subsequent step.
saikat09
 
Posts: 5
Joined: Thu Dec 12, 2013 11:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: Passing output to job using rexx

Postby NicC » Fri Dec 20, 2013 4:55 pm

No - except by the method suggested. Same as any other way to pass data from program to program. Why do you think that the programming language used would make a difference? Your JCL is fixed once it is interpreted at submission time. It is not interpreted at step start time. Therefor you either have dataset names fixed at submission time or use dynamic allocation.

If you are not referring to using dataset names determined "on the fly" then you do not need to worry about the allocation but then I do not see why you should have a problem - your output from the Rexx program is simply data which is written to a dataset which can then be read by other programs within the job or programs in other jobs.

By the way, please enclose your code within the code tags. I have done this for you this time.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post