0

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?

sCuper
  • 91
  • 2
  • 8
  • According to the BPXBATCH documentation you have to specify whether you are going to run a shell or a program: BPXBATCH SH [pgmname] | PGM [pgmname] – NicC Dec 17 '19 at 14:45
  • That is true. Initially it was there, but I had to change some of my code before I could post here, so it was removed in the process. Adding it back in now in my question (it was in my code the whole time, so the original problem prevails). – sCuper Dec 17 '19 at 17:53

3 Answers3

1

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                              
sCuper
  • 91
  • 2
  • 8
1

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'" 
VadimKo
  • 210
  • 1
  • 5
  • Thank you! This looks like it would work great! I don't really know that much about shellscripts, do you know about a good website that explains it well? Googled it a bit while looking for a solution to this, but most of what I found just talked about it without documenting how to write it. – sCuper Dec 18 '19 at 08:26
1

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)                                        
//* 
Rich Jackson
  • 301
  • 1
  • 5