Using OGET-command from within JCL

926 Views Asked by At

I have been trying to run the OGET-command from within a JCL. Normally I would use the ishell-command line using ISPF;6 and then run the command from there, however, this job is so big that I need to automate the task.

What I have tried so far is to use IKJEF01, IKJEFT01 and the OSHELL-command, and BPXBATCH to send the command, but none have worked.

The command I wish to use is the following:

OGET '/CPU/TMP/filename.IND' 'library.INDEX.EHH' BINARY CONVERT(NO)

My attempt with IKJEFT01 and OSHELL:

//TMP1  EXEC  PGM=IKJEFT01,                                 
//            DYNAMNBR=200                                  
//SYSPROC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR                   
//*                                                         
//SYSTSPRT DD  SYSOUT=*                                     
//SYSOUT   DD  SYSOUT=*                                     
//*                                                         
//SYSTSIN  DD  *                                            
OSHELL OGET '/CPU/TMP/filename.IND' 'library.INDEX.EHH' - 
             BINARY CONVERT(NO)                                        
//* 

My attempt using BPXBATCH:

//SHELLCMD  EXEC PGM=BPXBATCH                                        
//STDERR     DD SYSOUT=*                                             
//STDOUT     DD SYSOUT=*                                             
//STDPARM    DD *                                                    
SH OGET '/CPU2/TMP/filename.IND' 'library.INDEX.EHH' BINARY CONVERT(NO)
/*                                                                   

Both methods produce the same error:

FSUM1006 A shell was not specified. Processing continues using the default shell name.
FSUM7332 syntax error: got (, expecting Newline

If I remove CONVERT(NO), I get the following errors instead:

FSUM1006 A shell was not specified. Processing continues using the default shell name.
OGET: FSUM7351 not found 

Can anybody help?

3

There are 3 best solutions below

2
On

OGET is a TSO command, and is directly accessible via IKJEFT01. There is no need to invoke OSHELL or BPXBATCH (BTW... OSHELL is just a REXX that invokes BPXBATCH).

Simply use OGET directly (without the OSHELL command) in your original JCL and it will work:

//TMP1  EXEC  PGM=IKJEFT01,                                 
//            DYNAMNBR=200                                  
//SYSPROC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR                                                                          
//SYSTSPRT DD  SYSOUT=*                                     
//SYSOUT   DD  SYSOUT=*                                                                                            
//SYSTSIN  DD  *                                            
OGET '/CPU/TMP/filename.IND' 'library.INDEX.EHH' - 
             BINARY CONVERT(NO)                                        
//* 
1
On

I had similar task in the past and i end up with following solution:

//COPYSTEP EXEC PGM=IKJEFT01
//         SET SRC='/CPU2/tmp/filename.ind'
//         SET Q=''''
//IN       DD PATH=&Q.&SRC.&Q,PATHOPTS=(ORDONLY)
//OUT      DD DSN=LIBRARY.INDEX.EHH,DISP=(,CATLG),
//          SPACE=(TRK,(10,10),RLSE),RECFM=FB,LRECL=4000,BLKSIZE=0
//SYSTSPRT DD SYSOUT=*                                          
//SYSTSIN  DD *                                                  
 OCOPY INDD(IN) OUTDD(OUT) BINARY CONVERT(NO) PATHOPTS(USE)
/*

Another option was to create shell script in USS, and execute it from JCL.

//SHRUN  EXEC PGM=BPXBATCH,PARM='SH'                    
//STDIN     DD  PATH='/path/to/script/script.name',
//          PATHOPTS=(OCREAT,ORDONLY),                  
//          PATHMODE=(SIRWXU,SIROTH),                   
//          PATHDISP=(KEEP,KEEP)                        
//STDOUT  DD SYSOUT=*                                   
//STDERR  DD SYSOUT=*                                   
//STDENV  DD *

the script itself is very simple

cp -W "seqparms='RECFM=FB,LRECL=4000'" /CPU2/tmp/filename.ind "//'LIBRARY.INDEX.EHH'" 
0
On

I didn't find a way to solve my initial problem, but I wrote a REXX-script that did the job:

/* REXX demo */                                
ADDRESS TSO                                                  
"OGET '/CPU2/tmp/filename.ind'    'library.INDEX.EHH' BINARY
 CONVERT(NO)"   

This was called from my CNTL with the following code:

//STEPREXX EXEC PGM=IKJEFT01,PARM='REXX-name'
//SYSEXEC   DD DSN=PDS,DISP=SHR      
//SYSTSPRT  DD  SYSOUT=*                           
//SYSTSIN   DD  DUMMY