IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Command to copy the JCL from spool


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Thu Oct 30, 2014 6:46 pm
Reply with quote

Hi,

Is there any TSO/ISPF command to copy the particular job's JCL (shown when using 'SJ' command before the job) to a particular dataset or display it in TSO terminal?


I know the TSO command 'OUTPUT' to copy/Display the JES messages of a job.
Here the JCL present in JESJCL is expanded one.What I need is the JCL
present when using 'SJ' (showjcl) command.

Also let me know if i am missing anything here??


Thanks,
Arun
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Oct 30, 2014 7:00 pm
Reply with quote

After your "SJ" line command, why can't you simply do a CREATE primary command and create a new data set or PDS member at that point? Am I not understanding your question?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu Oct 30, 2014 7:01 pm
Reply with quote

Read up on the SDSF commands as per the help screens. Especially look for XDC - which is actually a concatenation of 3 line commands.
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Fri Oct 31, 2014 12:00 am
Reply with quote

Thanks for the response.


Hi Terry,

Actually I want to copy the JCLs for the list of jobs.Doing it manually is time consuming.So, I wanted to code a rexx which takes jobnames as input and
copy the JCLs in a file.

So, basically I want to invoke SDSF from Rexx,Is there any possibility??
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Fri Oct 31, 2014 12:10 am
Reply with quote

While at an SDSF panel: ===> rexxhelp
Back to top
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Fri Oct 31, 2014 9:56 am
Reply with quote

Hi Arun,
This may be silly, but just a try forgive me if its wrong.

After extracting JES with expanded JCL, issuing X all, F all //, del all x in ispf command using rexx.
Then we might have only JCL lines(I am not sure about sysin and instream lines)


Thanks:-)
Basha.
Back to top
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Fri Oct 31, 2014 11:03 am
Reply with quote

Hi Arun,

I have been using the below to extract JCL from JES log.

/* REXX */
/* =====================================================================
GETjcl will get the jcl from JES
PLEASE DONT CHANGE THIS MACRO.
================================================================== */
/* TRACE ?R */
"isredit macro () NOPROCESS "
"isredit HILITE JCL "
"isredit HILITE PAREN "
"isredit HILITE LOGIC "
"isredit HILITE RESET "
"isredit exclude all "
"isredit find all ' //' 10 12 "
"isredit find all ' /*' 10 12 "
"isredit delete all x "
i = 0
"isredit (LastLine) = LINENUM .ZLAST"
do until i >= LastLine
i = i + 1
j = 0
do until j >= 5
j = j + 1
"isredit SHIFT ( " i
end
end
Return

I sure this will work. Let me know after testing.

Thanks
Basha
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Fri Oct 31, 2014 6:01 pm
Reply with quote

Hi Basha,

Thank you.I too thought the option intially.But as you mentioned instream sysin is the issue.Basically I am loking for how to invoke SDSF thru REXX.


Hi Terry,

You got it right.I am going thru the tutorial.Mean while if you can provide me a simple
example of invoking any SDSF command in rexx it will be helpful.


Thanks,
Arun
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 31, 2014 6:15 pm
Reply with quote

Use the SEARCH button above

Type SDSF in the search fields and select only the CLIST & REXX forum.

Press ENTER and you will find lots of useful code snippets
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2593
Location: Silicon Valley

PostPosted: Fri Oct 31, 2014 8:44 pm
Reply with quote

Thanks Terry, I just learned of REXXHELP. It seems very useful. There are numerous examples there, in the 'examples' page.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Nov 02, 2014 6:39 pm
Reply with quote

Arunkumar Chandrasekaran wrote:
Basically I am looking for how to invoke SDSF thru REXX.
Also don't forget to study this redbook: Implementing REXX Support in SDSF
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Nov 04, 2014 1:09 pm
Reply with quote

Hi Pedro/Terry

Though I'm able to see the REXXHelp command on SDSF help panel, but when I try it says Invalid Command. How to invoke the REXXHelp command.

Code:
.-----------------------------------------------------------------------------.
| SC01                 HELP: SDSF -- Table of Contents      Invalid selection |
| COMMAND INPUT ===> REXXHELP                                                 |
|                                                                             |
|   Select a topic by number, or press Enter to view topics in sequence.      |
|                                                                             |
|    1 - What's new                         13 - Action bar                   |
|    2 - Job and workload panels            14 - PF keys and keylists         |
|    3 - Device and resource panels         15 - Action characters            |
|    4 - Search and scroll commands         16 - Overtypeable fields          |
|    5 - Filter commands                    17 - JES and MVS commands         |
|    6 - View commands                      18 - Point-and-shoot              |
|    7 - Print command and actions          19 - Online library               |
|    8 - Options commands                   20 - SDSF messages                |
|    9 - Other commands                                                       |
|   10 - Server commands              REXXHelp - SDSF REXX (ISPF only)        |
|   11 - SDSF command                                                         |
|   12 - Help commands                                                        |
|                                                                             |
|   SEARCH - Search the help (ISPF only)                                      |
|                                                                             |
| F1 = Help             F10 = Previous          Enter = Forward               |
| F3 = Exit              F7 = Up                TOC = Menu                    |
'-----------------------------------------------------------------------------'
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2593
Location: Silicon Valley

PostPosted: Tue Nov 04, 2014 9:30 pm
Reply with quote

Terry's instructions seemed pretty clear.
Quote:
While at an SDSF panel: ===> rexxhelp

Issue REXXHELP from panel ISFPCU41.
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 05, 2014 11:23 pm
Reply with quote

Hi all,

From my reference to older posts and manuals I confirmed 'SJ' is not available when invoking SDSF in batch and rexx since it uses ISPF service.

see the post below,

http://ibmmainframes.com/about37574.html

So, the only option is constructing JCL using JESJCL.

Thanks,
Arun
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Thu Nov 06, 2014 3:07 am
Reply with quote

a quick and dirty POC
I just plugged in MY job number


the input jcl (submitted)
Code:

 ****** ***************************** Top of Data ******************************
 000001 //ENRICO9 JOB (ACCT),'ZSTEPS',NOTIFY=ENRICO,
 000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
 000003 //S1   EXEC PGM=IEFBR14
 000004 //SOMEDD    DD *
 000005 AA
 000006 BB
 000007 CC
 ****** **************************** Bottom of Data ****************************


the result a quick and dirty say
Code:

 //ENRICO9 JOB (ACCT),'ZSTEPS',NOTIFY=ENRICO,
 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
 //S1   EXEC PGM=IEFBR14
 //SOMEDD    DD *
 AA
 BB
 CC


the rexx script
Code:

 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace  "O"
 000005 Parse Source _sys _how _cmd .
 000006 _dbg = 0
 000007
 000008 parse arg args
 000009 args = space(args)
 000010 argc = words(args)
 000011
 000012 jobid =  "JOB02150"
 000013 say "jobid " jobid
 000014
 000015 IsfRC = isfcalls("ON")
 000016 if IsfRC \= 0 then do
 000017     say "isfcalls RC" IsfRC
 000018     exit
 000019 end
 000020
 000021 isfprefix = ""
 000022 isfowner  = "*"
 000023 isffilter = ""
 000024 isffilter = "JOBID eq" jobid
 000025 isfcols   = "jname jobid "
 000026
 000027 isfiput   = "ON"
 000028 Address SDSF "isfexec st"
 000029 if RC \= 0 then do
 000030     say "isfexec  RC" RC
 000031     exit
 000032 end
 000033 say "jname.0" jname.0
 000034 say "isfrows" isfrows
 000035
 000036 do jnr = 1 to jname.0
 000037     say right(jnr,2) jname.jnr jobid.jnr
 000038     if jobid.jnr \= jobid then do
 000039         say "SKIPPED " right(jnr,2) jname.jnr jobid.jnr
 000040         iterate
 000041     end
 000042     say "PROCESS " right(jnr,2) jname.jnr jobid.jnr
 000043     jopts = "(PREFIX J)"
 000044     Address SDSF "ISFACT st TOKEN('"token.jnr"') PARM(NP ?) " jopts
 000045     if RC \= 0 then do
 000046        say "isfact   RC" RC
 000047        exit
 000048     end
 000049     jdd = 2
 000050     say right(jnr,2) jname.jnr jobid.jnr right(jdd,2) jddname.jdd
 000051
 000052     Address SDSF "ISFACT ST TOKEN('"jtoken.jdd"') PARM(NP SJA)"
 000053     "EXECIO * DISKR " isfddname.1 " ( OPEN FINIS STEM SPOOL. "
 000054     do i = 1 to spool.0
 000055        say strip(left(spool.i,71))
 000056     end
 000057     leave
 000058 end
 000059
 000060 call  isfcalls "OFF"
 000061 if _dbg = 1 then do
 000062     vlist = rxvars()
 000063     do v = 1 to words(vlist)
 000064        vname = word(vlist, v)
 000065        say left(vname,20) value(vname)
 000066     end
 000067 end
 000068 exit
 000069
 000070 Psa:      Procedure; Return                      '00'
 000071 Tcb:      Procedure; Return     C2x(Storage(X2x(Psa(), '21C'),4))
 000072 Jscb:     Procedure; Return     C2x(Storage(X2x(Tcb(),  'B4'),4))
 000073 Ssib:     Procedure; Return     C2x(Storage(X2x(Jscb(),'13C'),4))
 000074 Jobnumbr: Procedure; Return         Storage(X2x(Ssib(),  'C'),8)
 000075
 000076 X2x:      Procedure; Return D2x(X2d(Arg(1))+X2d(Arg(2)))
 ****** **************************** Bottom of Data ****************************


the trick for inline data is to set the variable ISFINPUT ( line 27 )
and use SJA ( line 52 )
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Thu Nov 06, 2014 1:29 pm
Reply with quote

Amazing Enrico !!!! Works perfectly.

This is what I expected.it is worth for the one week.Thanks a lot!!


Meanwhile I just want to clarify some of my queries in the code,


(1) I believe the below codes are not needed for this purpose ( Copying 'JCL' from a job)

Code:
PARSE SOURCE _SYS _HOW _CMD .   
_DBG = 0                       
                               
PARSE ARG ARGS                 
ARGS = SPACE(ARGS)             
ARGC = WORDS(ARGS)             

IF _DBG = 1 THEN DO                                               
    VLIST = RXVARS()                                               
    DO V = 1 TO WORDS(VLIST)                                       
       VNAME = WORD(VLIST, V)                                     
       SAY LEFT(VNAME,20) VALUE(VNAME)                             
    END                                                           
END                                                               
EXIT                                                               
                                                                   
PSA:      PROCEDURE; RETURN                      '00'             
TCB:      PROCEDURE; RETURN     C2X(STORAGE(X2X(PSA(), '21C'),4)) 
JSCB:     PROCEDURE; RETURN     C2X(STORAGE(X2X(TCB(),  'B4'),4)) 
SSIB:     PROCEDURE; RETURN     C2X(STORAGE(X2X(JSCB(),'13C'),4)) 
JOBNUMBR: PROCEDURE; RETURN         STORAGE(X2X(SSIB(),  'C'),8)   
                                                                   
                                                                   
X2X:      PROCEDURE; RETURN D2X(X2D(ARG(1))+X2D(ARG(2)))           


I tried after removing these codes, and it workd same.Please confirm if it is done with some purpose.


(2) Could you please throw some light on the below variables.

Code:
ISFIPUT   = "ON"

Code:
JDDNAME.JDD
&
Code:
JTOKEN.JDD

Code:
ISFDDNAME.1

I can understand JDD=2 since we are using JESJCL,When I gave it 3 it shows JESYSMSG in JDDNAME.JDD.But The file datas shows only JESJCL statements.


(3) Also SJA is not working in online & batch.Is it a special command works only in Rexx?? If so how it is working without ISPF service??



Thanks,
Arun
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Thu Nov 06, 2014 1:59 pm
Reply with quote

Quote:
Please confirm if it is done with some purpose.

none of that ...
just the consequence CUT and PASTE and REUSE icon_cool.gif

there are quite a bit of leftovers lines of code in the snippets I post

ISFINPUT according to the manuals controls the retrieval of inline data
( but ... I just tested and it looks like it does not make any difference )

as I said the snippet is a QUICK and DIRTY thing
so instead of using constants ( assuming 2 for the JESJCL <dataset> )
the <dataset> stem should be searched for the proper <dataset>


SJA is supposed to work only for the REXX interface

anyway the SDSF manual is still very imprecise in the description of some facilities
so You will have to experiment a bit

for example using SJA all the <datasets> return the jcl
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Thu Nov 06, 2014 2:39 pm
Reply with quote

follow on ...
rxvars is a REXX external function used to find out the names of all the rexx variables hanging around


I found it pretty useful to understand the REXX SDSF interface
quite a few variables are wrongly listed/described in the manual

just use it after every invocation of a REXX sdsf service

and You will gain a lot of understanding on how things work

see here the source and the supporting macros

ibmmainframes.com/viewtopic.php?t=59657&highlight=rxvars

here is how to use it ...

Code:
vlist = rxvars()
do v = 1 to words(vlist)
   vname = word(vlist, v)
   say vname value(vname)
end


P.S.

sdsf batch authorization checking works in a different way from the tso one

thats the reason why I have seen quite a few complaints about things working
under TSO and not when invoking the interface from batch
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts Help needed in automation cics transa... CLIST & REXX 1
No new posts How to Login in to cics region and is... CICS 9
No new posts Passing containers on START command CICS 4
Search our Forums:

Back to Top