View previous topic :: View next topic
|
Author |
Message |
mathi.vanan
New User
Joined: 11 Jan 2012 Posts: 18 Location: INDIA
|
|
|
|
Hi Gurus...
I am a beginner in REXX and am breaking my head to work on the following. I have two questions for which i need thoughts on. I had looked in previous posts but couldnt make out exactly for my need.
I need to build a rexx routine which would pass 2 dsn names and sort keys for a sort JCL. I believe that sort can be done within the REXX routine as well, but the JCL has few more functions as well.
The rexx routine would have N number of for DSNs and it would pass 2 DSNs every time to the sort JCL. i.e (the routine would call the JCL 'N' number of times)
Please provide me inputs or samples which i can work on. In case someone already has a snippet, please share.
Thanks. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Since this apppears to be a relatively simple task using a DO loop structure it would be great if you could show us what you've done so far and maybe point out where you're stuck. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2590 Location: Silicon Valley
|
|
|
|
Quote: |
I have two questions for which... |
It is not clear what your questions are... please re-state. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
mathi.vanan wrote: |
I need to build a rexx routine which would pass 2 dsn names and sort keys for a sort JCL. I believe that sort can be done within the REXX routine as well, but the JCL has few more functions as well.
The rexx routine would have N number of for DSNs and it would pass 2 DSNs every time to the sort JCL. i.e (the routine would call the JCL 'N' number of times) |
It is probably preferable that you not try to write this using only Rexx, but that you also use ISPF services.
Where will you get the DSNs from? Command line, ISPF panel, a data set? Are the input data sets expected to have identical DCBs? Will the control cards be the same for every sort?
Will you want to build multiple jobs, or one job with multiple steps? Will the JCL be submitted immediately, or will the JCL be held in a data set or data sets, or in a member or members of a PDS(E), for later review? |
|
Back to top |
|
|
mathi.vanan
New User
Joined: 11 Jan 2012 Posts: 18 Location: INDIA
|
|
|
|
Pedro and Akatsukami:
I have a list of around 200 files to be sorted and compared. The file names would be fixed and so i can use them within the REXX routine, inside a DO loop for calling the JCL.
But, i am stuck in how the file names and the sort keys are to be sent to the JCL. Sort keys would vary for each file. Hence i would be considering the JCL proc to be called for every file from the REXX routine in a loop.
I need help in how the file names and sort keys should be sent from REXX to JCL. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
For each interation of the loop, generate all of the jcl needed to run the batch job for that iteration. When the jcl is built, SUBmit the jcl and continue with the next iteration of the loop.
There is no "passing to jcl" - you create it as you need it. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10884 Location: italy
|
|
|
|
looks like the most difficult part would be to associate the proper sort cards to each dataset
is there anything in the dataset name to help You determine the sort cards
I would not have the sort cards <inlined> better store each set as a pds member and point the sort sysin to the appropriate member
no need to change the rexx if something changes
also if the datasets are fixed any reason to regenerate the jcl for each execution.
somehow the requirement does not look so clear |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
mathi.vanan wrote: |
But, i am stuck in how the file names and the sort keys are to be sent to the JCL. Sort keys would vary for each file. Hence i would be considering the JCL proc to be called for every file from the REXX routine in a loop.
I need help in how the file names and sort keys should be sent from REXX to JCL. |
Again, I would not use pure Rexx, but the ISPF file-tailoring services. Assuming that your DSNs and sort arguments are in stem variables, the pseudo-code would be:
Code: |
do i = 1 to lots
dsn1 = stem.1.i
dsn2 = stem.2.i
etc.
FTOPEN
FTINCL skeleton
FTCLOSE member-name-root || i
if (desired) then "SUBMIT" JCL
end |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Keeping in mind that you are very new to TSO/Online programming, what you want to do might not be the best task to do first. . . In addition to learning REXX you will probably need to learn some amount of ISPF. File Tailoring is a very good approach, but this is yet another completely new discipline to learn.
If this is wanted soon, it confuses me that the task was given to someone with no REXX experience. . .
Do you program in any mainframe languages? Long ago (before REXX on MVS) we wrote this kind of thing in COBOL (or assembler if one knew assembler). |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
mathi.vanan wrote: |
I have a list of around 200 files to be sorted and compared. |
Did you mean "100 couples" or is it "200 couples"?
Before writing even one line in REXX, you have to know exactly what program(s) you need to run for your purpose.
You also have to decide what to do with the output itself: Leave it in SDSF? Save it as members in a PDS?
Then create a job which processes one couple of files, run it until you have your desired output.
You have to decide whether you will run one job with the 200 couples in it, or 200 jobs with one couple in each.
Or, as you said, run the process from within your REXX program.
Base your decision on the expected CPU and elapse time, maybe.
Independently, create a parameter file which contains the file names.
I would use the format: dsname1 dsname2 sortinfo
It makes it easy to read in REXX:
Code: |
"EXECIO * DISKR FILELIST (FINIS STEM flist."
Do ifl = 1 to flist.0
Parse Var flist.ifl dsnleft dsnright sortkey
Call Process_files
End
Exit
Process_files:
Say "File one is <"dsnleft">"
Say "File two is <"dsnright">"
Say "Sort keys is <"sortkey">"
/* process here */
Return |
The process itself depends on what you decided earlier,
so do your thinking and checking and come back if you need more help (or rather when you need more help).
Also, start to learn about File Tailoring (4 services starting with FT in this book). |
|
Back to top |
|
|
Michael Jakob
New User
Joined: 13 Mar 2011 Posts: 17 Location: Switzerland
|
|
|
|
Did you check the possibility of filling and submitting by a stack?
/* create an new stack */
ADDRESS 'TSO' "NEWSTACK"
/* fill your stack with lines of jcl */
QUEUE "//XXX JOB (asdf)"
DO XX=1 TO 200;
QUEUE "//S01 EXEC PGM=ICETOOL"
QUEUE "//IN040 DD DISP=SHR,DSN="MYDSNAME.XX
...
END;
/* start your job */
ADDRESS "TSO" "SUBMIT *"
/* get rid of your private stack */
ADDRESS "TSO" "DELSTACK"
With each queue you create an line of JCL. In the queue statement, you can mix variables and constants. With this pattern, you can create easily an large JCL and submit it.
By the way with ICETOOL you can sort many datasets in one step. I would guess you could sort all 200 pairs of datasets in one step. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Why oh why oh why do people keep suggesting that JCL should be built instream by REXX.
Could someone please explain to me what the real big issue with using ISPF FT services are
Please |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
There are some possibilities :
people never heard about ISPF (and its services)
ISPF is not installed
and now im terrible tired guessing for more reasons. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10884 Location: italy
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
expat wrote: |
Why oh why oh why do people keep suggesting that JCL should be built instream by REXX.
Could someone please explain to me what the real big issue with using ISPF FT services are
Please |
None that I can think of.
Some aspects of FT skeleton syntax used to be somewhat arcane, but now that structures such as )IF )ELSE )ENDIF and )DO )ITERATE )LEAVE )ENDDO and )REXX )ENDREXX are supported FT much more closely resembles other programming languages. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I'll admit that I don't use File Tailoring Services much myself. I think a lot of that has to do with the fact that I'm usually writing REXX for batch processes, and that these are usually one-off single process types of exercises. Not much of an excuse, I know. I think if I was doing more foreground processing and sharing resources among a large group I'd rely much more on FT services. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10884 Location: italy
|
|
|
|
here is a snippet using the latest ISPF facilities
the REXX script ( save it with any name You want )
Code: |
****** ***************************** Top of Data ******************************
000001 /* REXX */
000002 Trace "O"
000003 jmax = 2
000004 smax = 2
000005 call $ispex "FTOPEN TEMP"
000006 call $ispex "FTINCL JSKEl2"
000007 call $ispex "FTCLOSE "
000008 call $ispex "VGET ZTEMPF "
000009 call $ispex "VIEW DATASET('"ztempf"')"
000010 Exit 0
000011
000012 /* */
000013 $ispex:
000014 isp_0tr = trace("O")
000015 Address ISPEXEC arg(1)
000016 isp_0rc = rc
000017 trace value(isp_0tr)
000018 return isp_0rc
****** **************************** Bottom of Data **************************** |
the JOB skel ( save it as JSKEL2 )
Code: |
****** ***************************** Top of Data ******************************
000001 )DO JNUM = 1 TO &JMAX
000002 //J&JNUM JOB (ACCT),'JSKEL',NOTIFY=ENRICO,
000003 // CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000004 //* JOB &JNUM OF &JMAX
000005 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000006 )DO SNUM = 1 TO &SMAX
000007 )IM SSKEL2
000008 )ENDDO
000009 //*
000010 )ENDDO
****** **************************** Bottom of Data **************************** |
the STEP skel ( save it as SSKEL2 )
Code: |
****** ***************************** Top of Data ******************************
000001 //S&SNUM EXEC PGM=IEFBR14
000002 //* JOB &JNUM OF &JMAX
000003 //* STEP &SNUM OF &SMAX
000004 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
****** **************************** Bottom of Data ****************************
|
have fun
( TESTED AND WORKING )
but the top skel could also be written as
Code: |
****** ***************************** Top of Data ******************************
000001 )DO JNUM = 1 TO &JMAX
000002 //J&JNUM JOB (ACCT),'JSKEL',NOTIFY=ENRICO,
000003 // CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000004 //* JOB &JNUM OF &JMAX
000005 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000006 )DO SNUM = 1 TO &SMAX
000007 //S&SNUM EXEC PGM=IEFBR14
000008 //* JOB &JNUM OF &JMAX
000009 //* STEP &SNUM OF &SMAX
000010 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000011 )ENDDO
000012 //*
000013 )ENDDO
****** **************************** Bottom of Data **************************** |
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Two weeks since mathi.vanan last post.
It would be nice to hear if he finished "breaking his head"... |
|
Back to top |
|
|
chaoj
Active User
Joined: 03 Jun 2010 Posts: 103 Location: Dalian
|
|
|
|
expat wrote: |
Why oh why oh why do people keep suggesting that JCL should be built instream by REXX.
Could someone please explain to me what the real big issue with using ISPF FT services are
Please |
Some times I need call rexx code in JCL , If I use ISPF service in rexx , I need allocate many ISPF lib with DD card like ISPMLIB,ISPPLIB....
and because the ISPF lib in develop environment is different from the product environment in my side, so I need write JCL twice . This is my reason for not use ISPF service if I call rexx code in JCL. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10884 Location: italy
|
|
|
|
Quote: |
and because the ISPF lib in develop environment is different from the product environment in my side, so I need write JCL twice . This is my reason for not use ISPF service if I call rexx code in JCL. |
stupid reason not to use the ISPF functionalities
I have never seen (*) BATCH ISPF execution use nothing more than the basic ISPF libraries
and just the user load and rexx/clist libraries
(*) I have been using REXX and ISPF since their appearance on the scene
a few hundreds scripts and couple dozen customers
Code: |
000005 //ISPF EXEC PGM=IKJEFT1A,PARM='ISPSTART CMD(YOURREXX)'
000006 //STEPLIB DD DISP=SHR,DSN=YOUR.LOAD.LIBRARY
000007 //SYSPROC DD DISP=SHR,DSN=YOUR.REXX.LIBRARY
000008 //ISPPROF DD DISP=(,PASS),DSN=&&ISPPROF,
000009 // UNIT=SYSDA,SPACE=(CYL,(2,0,44)),
000010 // DCB=(RECFM=FB,LRECL=80)
000011 //ISPPLIB DD DISP=SHR,DSN=ISP.SISPPENU
000012 //ISPMLIB DD DISP=SHR,DSN=ISP.SISPMENU
000013 //ISPSLIB DD DISP=SHR,DSN=ISP.SISPSLIB
000014 //ISPTLIB DD DISP=SHR,DSN=ISP.SISPTENU
000015 //SYSPRINT DD SYSOUT=*
000016 //SYSTSPRT DD SYSOUT=*
000017 //SYSTSIN DD DUMMY
|
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
The other bogus excuse for not using ISPF facilities is: "it adds too much overhead". So they end up writing an extra 500 lines of code to do what ISPF services can do with one call. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
chaoj wrote: |
and because the ISPF lib in develop environment is different from the product environment in my side, so I need write JCL twice . This is my reason for not use ISPF service if I call rexx code in JCL. |
Unlike every other library in your development environment?
My current client's development and test environments are on different sysplexes than its production environments. Still, the libraries (and all other data sets) have different HLQs. |
|
Back to top |
|
|
chaoj
Active User
Joined: 03 Jun 2010 Posts: 103 Location: Dalian
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
and because the ISPF lib in develop environment is different from the product environment in my side, so I need write JCL twice . This is my reason for not use ISPF service if I call rexx code in JCL. |
stupid reason not to use the ISPF functionalities
I have never seen (*) BATCH ISPF execution use nothing more than the basic ISPF libraries
and just the user load and rexx/clist libraries
(*) I have been using REXX and ISPF since their appearance on the scene
a few hundreds scripts and couple dozen customers
Code: |
000005 //ISPF EXEC PGM=IKJEFT1A,PARM='ISPSTART CMD(YOURREXX)'
000006 //STEPLIB DD DISP=SHR,DSN=YOUR.LOAD.LIBRARY
000007 //SYSPROC DD DISP=SHR,DSN=YOUR.REXX.LIBRARY
000008 //ISPPROF DD DISP=(,PASS),DSN=&&ISPPROF,
000009 // UNIT=SYSDA,SPACE=(CYL,(2,0,44)),
000010 // DCB=(RECFM=FB,LRECL=80)
000011 //ISPPLIB DD DISP=SHR,DSN=ISP.SISPPENU
000012 //ISPMLIB DD DISP=SHR,DSN=ISP.SISPMENU
000013 //ISPSLIB DD DISP=SHR,DSN=ISP.SISPSLIB
000014 //ISPTLIB DD DISP=SHR,DSN=ISP.SISPTENU
000015 //SYSPRINT DD SYSOUT=*
000016 //SYSTSPRT DD SYSOUT=*
000017 //SYSTSIN DD DUMMY
|
|
Sometimes people should say something stupid , or they can not learn from others
You're right enrico , I used basic ISPF libraries , it's working
my code is below
Code: |
//RUNREXX EXEC PGM=IKJEFT01
//SYSEXEC DD DSN=PK80I.EV6946.EXEC,DISP=SHR
//ISPPROF DD DISP=(,PASS),DSN=&&ISPPROF,
// UNIT=SYSDA,SPACE=(CYL,(2,0,44)),
// DCB=(RECFM=FB,LRECL=80)
//ISPPLIB DD DSN=SYS1.SISPPENU,DISP=SHR
//ISPSLIB DD DSN=SYS1.SISPSENU,DISP=SHR
//ISPTLIB DD DSN=SYS1.SISPTENU,DISP=SHR
//ISPMLIB DD DSN=SYS1.SISPMENU,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
ISPSTART CMD(%ZREXXBAT)
/* |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2590 Location: Silicon Valley
|
|
|
|
Quote: |
So they end up writing an extra 500 lines of code to do what ISPF services can do with one call. |
Actually, I think that in some instances the overhead is a valid concern (though your results may vary). If the program is doing something repeatedly, then your 500 lines of code may be better than one call to ISPF services. That one call to ISPF services may result in executing thousands of lines of ISPF's code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10884 Location: italy
|
|
|
|
if there are overhead and performance concerns REXX,ISPF and friends should not be used FULL STOP |
|
Back to top |
|
|
|