Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sample REXX Code for JCl Submission

Status
Not open for further replies.

jainmanish123

Programmer
Jul 27, 2005
8
US

Can I get sample REXX code for JCL Submission, in which I can bypass the steps (Conditonal Overrides)

manish_igs1@yahoo.com
 
Just use the Internal Reader and Write the JCL cards to it, then close it.

Snippet Batch Job, runs REXX code, uses internal reader..

//REXXTEST EXEC PGM=IKJEFT01,PARM='REXXTEST'
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
//*
//* INTERNAL READER - SUBMITTED JOBS..
//REXXJOB DD SYSOUT=(A,INTRDR)
//*

In your REXX code (RXTEST) you need to use EXECIO and
write your JCL JOB cards to the REXXJOB DD (which points
to the Internal Reader)

Use REXX Stem vars() to accomplish this..

Example..

JobCard.1 = "//TSTJOB JOB SPCTECH,'TECH SUPPORT',CLASS=X"
JobCard.2 = "//*"
JobCard.3 = "//EXEC PGM=BLAH"
Jobcard.4 = "//*"

JobCard.0 = 4 /* Set Number of Stem Elements... */

ETC...

Then

Example Code snippet...

"EXECIO * DISKW REXXJOB (FINIS STEM JobCard."

If you have correctly setup the job (via the JobCard. stem element(s) then this will work fine.

This is a quick and dirty example.. but works..

You may need to add an "/*EOF" As the LAST JobCard. element so that JES2 (I am assuming this is JES2) will see the End-of-File indicator.. Of course if so.. then increase the total JobCard.0 Stem count by 1.


 
I strongly advise my students to NEVER (is that strong enough?) write
Code:
"EXECIO * DISKW ...."

There is always enough information available to avoid it. In the example above, you could
Code:
"EXECIO" JobCard.0 "DISKW REXXJOB (FINIS STEM JobCard."

If you are (as I am) a queue-user, you can
Code:
"EXECIO" queued() "DISKW  ..."
and dispense with loading a null record at the bottom of the stack.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Hi,

I tried the above solutions. But still I am not sure, how to bypass the steps in a Job using REXX.

Please advise me.

manish_igs1@yahoo.com
 
Here's some advice: REXX is not JCL. You can't 'bypass the steps in a Job using REXX' unless you actually have the REXX code excise the steps to be bypassed from the job, and then they're not part of the job any longer, are they?

You bypass steps in a job using JCL facilities (which are not REXX facilities).

Really, it would help very much if you were to go find the appropriate manuals and read them. It would help very much more if you were to locate some of the more experienced people at your site and ask them to give you some training, because it's quite clear you haven't had any.

You're lucky you got even one answer to your original question. This is Tek-Tips.com, not DoMyWorkForMe.com.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Frank,

This is the original guy who replied to the original posters question.

I could not agree with you more on your last post :).

My question relates to your first answer in that you say "NEVER" to use EXECIO * DISKW.

Now, I am curious.. Why NEVER?. Is it for programming clarity, performance?

Just curious.

Thanks,

Gary D - zSoftware
 

New thread.... see "Never use EXECIO * DISKW"

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Thanks Frank and Gary.

The Input file has say around 10 diferent records.In the output file all those 10 records should be with 10 diiferent name (from input).

Record Input Output
1 M1 N1
2 M2 N2
3 M3 N3
.
.
10 M10 N10

I know that I could acheive it by Parsing. But my question is do I need to have a long If-Else loop so that program will know that if it is M1 then change it to N1.. and same for other records... Or I can acheive it by some another simpler way.

Please advise.

Thanks,
Manish
 
I have no clue as to what your above posting has in any relation to your original question.

I really cannot even begin to help on this.

 
Thanks for your response....

Let me explain it again.. Say I have a file which has 10 records in it.

Now I want change this file, mean XXXXXXX Present in record 7th will change to YYYYYYY.And 8th Record will change from AAAAAAA to BBBBBBB.

Now my question is, if I use a IF-ELSE loop, then it will be too long. Do there is any simpler solution for this type of problem.

 

Unless you can calculate the conversion, you'll have to set up the mapping. That means either a SELECT, a series of if-then-else, or a look-up table.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Can you do anything with the format of the input file, or is it generated by some other program? I'm thinking along the lines of ISPF File Tailoring, where you could have an input file
Code:
&A
&B
&C
...
&X
and just tailor the file so that it would substitute the variables for you?
 
Thanks Frank and stevexff,

Frank, I am workign on the solution which you have suggested. The only porblem is that my if-else loop code is going to be around 700 lines.

Stevexff, Can you suggest me about the file tailoring..
Ex: My file has following record
//OCOPY001 DD DSN=&ID..PJ6205.&DC.PJAUD&RUNNUM,DISP=(NEW,CATLG,),

Here I need to Change &ID to B2NPJT1, &DC to X and &RUNNUM TO 01.

Now can you please suggest me how to achieve it without If-else. This is just an example (with 3 fields), as There are around 60 fields, which I have to change

Thanks
 
Have you considered making your JCL into a procedure, so you can make your invoking JCL simpler, e.g.
Code:
//S1 EXEC MYPROC,
// ID=value,
// RUNNO=value, ...

Provided that you can set the variables ID and RUNNUM in your REXX, the FTINCL service will perform variable substitution for you. It has the advantage that it treats the whole file as substitutable text, not just the JCL, so you can use it to tailor utility control cards as well, if this is required.

It's a few years since I've had access to a z/OS system so I can't remember the syntax, but it basically goes:

1. Allocate the ISPSLIB
2. Allocate ISPFILE
3. Set the variables (may need to VPUT them)
4. Tailor the skeleton file on to ISPFILE
5. Submit it
 
Thanks for your help.I am able to get the results with a BIG if-else loop.

In addiiton to that, I have one more query. I would like to break a line into 2-3 parts, Like:

Manish DD DSN=XXXXX.YYYYY.ZZZZZ.AAAAA.BBBBB, DISP=SHR

I would like to break this into

Manish DD DISP=SHR
DSN=XXXXX.YYYYY.ZZZZZ.AAAAA.BBBBB

Can you suggest me how to handle this case in a simpler way.

Thanks,
Manish
 
I'm not clear about what you want to do here. If you just want the syntax, then
Code:
//MANISH DD DISP=SHR,
// DSN=XX....
will do it.

But you might find it easier to
Code:
//MANISH PROC X=,Y=,Z=
//S1   EXEC PGM=MYPROG
//MANISH DD DISP=SHR,DSN=&X..&Y..&Z..AAAAAA.BBBBBB
and then
Code:
//MANISH JOB ..........
//S1 EXEC MANISH,X=SYS1,Y=MANISH,Z=INPUT
This splits most of the JCL out into a procedure where you can maintain it in an editor, and makes the invoking JCL simpler. JES2 will perform the symbolic substitution on the PROC without having to worry about the length of the resolved symbols.
 
The simplest way to avoid a long series of if-then-else:
Code:
swap. = '??' 
swap.ZORK = 'SNARK'
swap.BLURT = 'ZIPF'
...etc...
do queued()
   pull line 
   parse var line front "=" tag back
   if swap.tag = "??" then swap.tag = tag
   queue front"="swap.tag back
end
The queue is still intact but any tag-value for which you defined a 'swap' has been replaced. (Obviously, the exact form of the parse and queue are data-dependent, but you get the idea...)


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Steve,

The Question is very simple. I have around 10 records which is exceeding length above 80 (in the JCL), Like:

//stevexff DD DSN=XXXXX.YYYYY.ZZZZZ.AAAAA.BBBBB, DISP=SHR

Now I want that DSN and DISP will come in two different lines like below, so that the length will not exceeding 80 char bytes.

//stevexff DD DSN=XXXXX.YYYYY.ZZZZZ.AAAAA.BBBBB,
DISP=SHR

(OR)

//stevexff DD DISP=SHR,
DSN=XXXXX.YYYYY.ZZZZZ.AAAAA.BBBBB


I think now it is very much clear. Please suggest how to acheive it by Parsing.

Thanks,
Manish


Frank,
Thanks for your response. I am done with the BIG IF-ELSE loop.

Thnak,
Manish
 
Manish

The point I was trying to make is that it's only the JCL 'cards' that have a limitation of column 71. When you use a procedure, the JES2 interpreter does the substitution and expansion as it goes through the internal reader, and the length restrictions don't apply at this point. This rule does not apply if you choose to do all the substitution manually in your REXX before you submit the job.

In any case, the first example I gave you will allow continuation on to the next line
Code:
//MANISH DD DISP=SHR,
// DSN=XX.YY.ZZ.ETC.ETC
 
Steve,

My question is on REXX. See I have wrote REXX which is doing all the substitutions and in few case since the length exceeding 71 char, it is giving me problem.

I know whatever you proposed in above 2 solutions. But it will not going to solve the issue.

Let me explain it again.

I have a File in Proc
//MANISH DD DSN=DSXX.RUN.CONTROL(STEVEXFF),DISP=SHR

Now when I am replacing DSXX with say MANISH.STEVEXFF.REXX, using REXX, then the length is exceeding 71.

Now the question is how to break this into 2 parts.

I hope now it is more clear to you.

Thanks,
Manish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top