OnDemand User Group

Tips and Tricks => Tips and Tricks => Topic started by: Ed_Arnold on May 13, 2016, 09:17:38 AM

Title: JCL That I Find Handy
Post by: Ed_Arnold on May 13, 2016, 09:17:38 AM
Starting a thread to post some JCL that I use to solve CMOD issues.  Feel free to post yours here as well.

Problem:  testing arsload from spool, wanted to copy the IVP #1 sample file to spool class D.


//GENER   EXEC PGM=IEBGENER                                 
//SYSPRINT DD  SYSOUT=*                                     
//SYSUT1  DD PATH='/usr/lpp/ars/V9R5M0/samples/ARSIVPR1.out',
//       LRECL=133,RECFM=FB,BLKSIZE=399,                     
//       PATHOPTS=(ORDONLY),                                 
//       FILEDATA=TEXT                                       
//SYSUT2   DD  SYSOUT=D                                     
//SYSIN    DD  DUMMY                                         


Ed



Title: Re: JCL That I Find Handy
Post by: Ed_Arnold on May 31, 2016, 08:55:15 AM
Problem:

Load failed using arsload to load linedata when there is a tab character in the string defined as index.

Quote
ARS1128E
 Row row_number: The string \"string\" has the column delimiter in it
 Explanation
 The command failed because the specified string contains a character
 that is the same as the column delimiter that is currently being used by
 the command.
 User response
 Resubmit the command with a different column delimiter.

Solution:

ICETOOL job to change the character

http://www.ibmmainframeforum.com/dfsort-icetool-icegener/topic3322.html (http://www.ibmmainframeforum.com/dfsort-icetool-icegener/topic3322.html)

Ed
Title: ARSSTASH - Here's One That Can't Be Solved By JCL
Post by: Ed_Arnold on June 14, 2016, 06:51:01 AM
Trying to save anyone the frustration I just went through...

I tried to put the arsstash -c command in JCL.

I tried every trick in the book I had for feeding in the password.


It turns out the arsstash command can't be put into JCL.

The reason is the getpass() function that is invoked to read the password without echoing won't work unless you have a terminal:

Quote
getpass() only works in an environment where either a controlling terminal exists, or stdin and stderr refer to tty devices. Specifically, it does not work in a TSO environment.

https://www.ibm.com/support/knowledgecenter/SSLTBW_1.13.0/com.ibm.zos.r13.bpxbd00/rgpass.htm#rgpass (https://www.ibm.com/support/knowledgecenter/SSLTBW_1.13.0/com.ibm.zos.r13.bpxbd00/rgpass.htm#rgpass)

One of the main purposes of arsstash was to not have passwords anywhere in the clear. 

Putting the password in a file (stdin/stdparm/SYSIN DD * /whatever) in the clear defeats that purpose.

Ed
Title: ARSEXOAM - how do you specify the stash file in JCL?
Post by: Ed_Arnold on September 27, 2016, 01:30:47 PM
********************************* Top of Data ***********************
//ARSEXOAM JOB (account),userid,MSGCLASS=A                           
//**************************************************************     
//STEP1    EXEC PGM=ARSEXOAM,REGION=0M                               
//STEPLIB  DD DISP=SHR,DSN=ARS.V9R5M0.SARSLOAD                       
//         DD DISP=SHR,DSN=DB2.V10R1M0.SDSNEXIT                     
//         DD DISP=SHR,DSN=DB2.V10R1M0.SDSNLOAD                     
//         DD DISP=SHR,DSN=DB2.V10R1M0.SDSNLOD2                     
//DSNAOINI DD PATH='/usr/lpp/ars/V9R5M0/config/cli.ini'             
//SYSPRINT DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//ARSPARM  DD *                                                     
  odinstance=ARCHIVE                                                 
  oduser=arsuser                                                     
  oduserpw=/path/to/ars.stash
  commitcnt=1000                                                       
  unloadmax=1000 
/*                                               
******************************** Bottom of Data *********************
Title: Re: JCL That I Find Handy
Post by: Alessandro Perucchi on September 28, 2016, 12:24:44 AM
Trying to save anyone the frustration I just went through...

I tried to put the arsstash -c command in JCL.

I tried every trick in the book I had for feeding in the password.


It turns out the arsstash command can't be put into JCL.

The reason is the getpass() function that is invoked to read the password without echoing won't work unless you have a terminal:

Quote
getpass() only works in an environment where either a controlling terminal exists, or stdin and stderr refer to tty devices. Specifically, it does not work in a TSO environment.

https://www.ibm.com/support/knowledgecenter/SSLTBW_1.13.0/com.ibm.zos.r13.bpxbd00/rgpass.htm#rgpass (https://www.ibm.com/support/knowledgecenter/SSLTBW_1.13.0/com.ibm.zos.r13.bpxbd00/rgpass.htm#rgpass)

One of the main purposes of arsstash was to not have passwords anywhere in the clear. 

Putting the password in a file (stdin/stdparm/SYSIN DD * /whatever) in the clear defeats that purpose.


Well if I may... there are tools, like in Linux world called Vault, which their main purpose is to keep all password in your environment safe, and give the password to the process that needs it in a secure way.
So, one of the usage of Vault, could be to automate the creation of CMOD technical users in CMOD with the correct password AND at the same time, create the stash file automatically for it. And in that case you need to be able to pass the password without using a terminal, and therefore the way it is handle with the getpass() is counterproductive and defeat the purpose of such handy tools.

So depending on how you look at it, the glass is half full or half empty or the glass contain half the content of water that you van pour in it or the glass contains the same amount of air and water in the glass!! :-D
Title: Putting a Marker in the z/OS System Console Log
Post by: Ed_Arnold on October 18, 2016, 01:33:20 PM
Suppose you're running some batch job over and over again.

Also suppose that your z/OS system console log is just busier than heck and searching through it every time to find something is onerous.

Insert the following step into your JCL:

Quote
//TMP1  EXEC  PGM=IKJEFT01,                     
//            DYNAMNBR=200                     
//SYSPROC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR       
//*                                             
//SYSTSPRT DD  SYSOUT=*                         
//*                                             
//SYSTSIN  DD  *                               
 oshell logger -d1 Arnold eyecatcher Number 1   
//*                                             
//STDOUT DD SYSOUT=*                           
//STDERR DD SYSOUT=*                           

(Submitted with jobname = LOGGER under userid ED)

That will put a line in the console log that looks like this:

JOB05877 00000090  IEF403I LOGGER - STARTED - TIME=16.28.05       
STC05865 00000090  +ED: 33554561: Arnold eyecatcher Number 1
 

Ed


Title: Copying HFS files from one directory to another
Post by: Ed_Arnold on August 08, 2017, 10:48:31 AM
There are many ways to do this and everybody has their favorite.

Mine is to do it via batch with the COPYTREE utility:

//GO      EXEC PGM=IKJEFT01                           
//SYSEXEC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR             
//SYSTSPRT DD  SYSOUT=*                               
//SYSTSIN  DD  *                                       
  oshell /samples/copytree /fromdir /todir
   

Browse /samples/copytree for a full description.     
Title: Re: JCL That I Find Handy
Post by: Ed_Arnold on August 08, 2017, 10:53:40 AM
A couple quick ways to check the health of your files on USS:

1. The validate utility for cache files in CMOD:

http://www.odusergroup.org/forums/index.php?topic=559.0

2. Run COPYTREE without a target file.

Example to check everything under /usr/lpp :

//DOSTEP  EXEC PGM=IKJEFT01,REGION=0M     
//SYSEXEC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR 
//SYSTSPRT DD  SYSOUT=*                   
//SYSTSIN  DD  *                           
  oshell /samples/copytree /usr/lpp   
     

Doc on this is available by browsing /samples/copytree

Ed
Title: Re: JCL That I Find Handy
Post by: Ed_Arnold on July 06, 2018, 01:39:04 PM
Supposed your userid's dot-profile is all set up for CMOD V9.5.

Now suppose you want to run some batch against your new V10.1 instance.

This JCL works fine for running against V9.5:

//JOBLIB   DD DISP=SHR,DSN=ARS.ARSV950.SARSLOAD       
//         DD DISP=SHR,DSN=DB2.V11R1M0.SDSNEXIT       
//         DD DISP=SHR,DSN=DB2.V11R1M0.SDSNLOAD       
//         DD DISP=SHR,DSN=DB2.V11R1M0.SDSNLOD2       
//STEP3    EXEC PGM=BPXBATCH,REGION=0M                 
//*                                                   
//*                                                   
//SYSPRINT DD SYSOUT=*                                 
//DSNAOINI DD PATH='/usr/lpp/ars/V9R5M0/config/cli.ini'
//ARSBIN   DD PATH='/usr/lpp/ars/V9R5M0/bin'           
//SYSOUT   DD SYSOUT=*                                 
//STDERR   DD SYSOUT=*                                 
//STDOUT   DD SYSOUT=*                                 
//STDPARM DD *                                         
SH  /usr/lpp/ars/V9R5M0/bin/arsdb    -I ARCH950 -mv   
/*                                                     


However, even though you change everything in the JCL to point to the V10.1 instance you get RC=256 and the error message:

ARS0013E DB Error: Warning:  Unexpected SQL_NO_DATA -- SQLSTATE=N/A, SQLCODE=100, File=arsmvsie.c, Line=1048
arsdb: ARS4012E Unable to initialize environment. The return code is 6         

//JOBLIB   DD DISP=SHR,DSN=ARS.ARSV1010.SARSLOAD       
//         DD DISP=SHR,DSN=DB2.V12R1M0.SDSNEXIT         
//         DD DISP=SHR,DSN=DB2.V12R1M0.SDSNLOAD         
//         DD DISP=SHR,DSN=DB2.V12R1M0.SDSNLOD2         
//STEP3    EXEC PGM=BPXBATCH,REGION=0M                 
//*                                                     
//*                                                     
//SYSPRINT DD SYSOUT=*                                 
//DSNAOINI DD PATH='/etc/ars/V1010/cli.ini'             
//ARSBIN   DD PATH='/usr/lpp/ars/V10R1M0/bin'           
//SYSOUT   DD SYSOUT=*                                 
//STDERR   DD SYSOUT=*                                 
//STDOUT   DD SYSOUT=*                                 
//STDPARM DD *                                         
SH  /usr/lpp/ars/V10R1M0/bin/arsdb    -I ARCH1010 -mv   
/*                                                     


The trick is to add the exports:

//STEP3    EXEC PGM=BPXBATCH,REGION=0M                     
//*                                                         
//*                                                         
//SYSPRINT DD SYSOUT=*                                     
//SYSOUT   DD SYSOUT=*                                     
//STDERR   DD SYSOUT=*                                     
//STDOUT   DD SYSOUT=*                                     
//STDPARM DD *                                             
SH                                                         
export DSNAOINI=/etc/ars/V1010/cli.ini;                     
export STEPLIB=DB2.V12R1M0.SDSNLOD2:DB2.V12R1M0.SDSNLOAD;   
/usr/lpp/ars/V10R1M0/bin/arsdb    -I ARCH1010 -mv;         
/*                                                         


Ed
Title: Re: JCL That I Find Handy
Post by: Ed_Arnold on July 13, 2018, 07:54:12 AM
When using a //DD:PARM if it's not working for you, put each parm on a separate line.

Ref:

https://www.ibm.com/support/knowledgecenter/en/SSQHWE_9.5.0/com.ibm.ondemand.administeringzos.doc/dodal002.htm (https://www.ibm.com/support/knowledgecenter/en/SSQHWE_9.5.0/com.ibm.ondemand.administeringzos.doc/dodal002.htm)

//STEP1    EXEC PGM=ARSLOAD,REGION=0M,
// PARM=('/-V //DD:PARM -u odadmin -p passwd')
//STEPLIB  DD DSN=ARS.V9R5M0.SARSLOAD,DISP=SHR
//         DD DSN=DB2.V10R1M0.SDSNEXIT,DISP=SHR 
//         DD DSN=DB2.V10R1M0.SDSNLOAD,DISP=SHR 
//         DD DSN=ACIF.V2R3M1.SAPKMOD1,DISP=SHR
//DSNAOINI DD PATH='/opt/IBM/ondemand/V9.5/config/cli.ini'
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//INPUT    DD DSN=PSF.SAPKSAM3(APKBANK),DISP=SHR
//CEEDUMP  DD SYSOUT=*.
//PARM     DD *
-h
ARCHIVE
-n
-g
appGrp
-s
INPUT
afp
/*
Title: Re: JCL That I Find Handy
Post by: Ed_Arnold on July 26, 2018, 10:46:44 AM
Certificates - listing info in z/OS

//TMP1  EXEC  PGM=IKJEFT01,                           
//            DYNAMNBR=200                             
//*                                                   
//SYSTSPRT DD  SYSOUT=*                               
//*                                                   
//SYSTSIN  DD  *                                                                       
 RACDCERT SITE LIST
 RACDCERT CERTAUTH LIST                                   
/*


If you have WAS on the system you may have some certificate data already on your system

//TMP3  EXEC  PGM=IKJEFT01,                               
//            DYNAMNBR=200                                                 
//*                                                       
//SYSTSPRT DD  SYSOUT=*                                   
//*                                                       
//SYSTSIN  DD  *                                           
 RACDCERT LISTRING (WASKeyring)         ID(WSADMIN)       
 RACDCERT ID(WSADMIN)  LIST                               
 RACDCERT ID(WSADMIN)  LISTMAP                             
/*
Title: Re: delete z/OS ver.9.5 JCL with proc
Post by: FAIK KARAGOZ on January 15, 2019, 03:40:05 AM
Del-unload. jobb.
//BGXXXXX JOB (DCLP,B647),'DEL ODV95',COND=(0,LT),
//             CLASS=A,REGION=500M,                 
//             MSGCLASS=X,                         
//             MSGLEVEL=(1,1),                     
//             NOTIFY=BG0FKA                       
 //S010     EXEC PROC=DELODV95,APG='BGV2X',                             
//        L='12879-1708-0-7FAA-20140509000000-20140509000000-12880'     
----
del  proc  i proc. bibliotek  . DELODV95
 //DELODV95 PROC SIZE=500M,                   
 //         H=ARCHIVE                         
 //*-------------------------------------------
 //ARSLDELT EXEC PGM=ARSADMIN,REGION=&SIZE,   
 // PARM=('/unload -h&H  -Q -g&APG  -L&L')     
 //STEPLIB  DD DISP=SHR,DSN=CMOP.PROD.ARSLOAD 
 //         DD DISP=SHR,DSN=DB0P.PROD.SDSNEXIT
 //         DD DISP=SHR,DSN=DB0P.PROD.SDSNLOAD
 //CEEDUMP  DD SYSOUT=*                       
 //ARSBIN   DD PATH='/usr/lpp/ars/V9R5M0/bin' 
 //SYSPRINT DD SYSOUT=*                       
 //SYSOUT   DD SYSOUT=*                       
 //STDERR   DD SYSOUT=*                       
Title: JES2 Parm Checker
Post by: Ed_Arnold on August 03, 2020, 01:37:45 PM
Maybe old news to many of you but I just learned of this:

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.hasa300/run_dscheck.htm (https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.hasa300/run_dscheck.htm)

I used what looked like the easiest method:

//JES2CHK JOB blah blah blah                     
//JES2    EXEC JES2               
//IEFPROC.HASPLIST DD SYSOUT=A   


This is what I got on my system:

First an echoing of all of the JES2 parms and where they came from.

Then this:

DIAGNOSTIC   WARNING    $HASP465 RMT2 SPECIFIES INVALID LINE VALUE

and

Error Summary:                             
                                           
         Type                          Count
         --------------------------  -------
         Warnings                          1
         Init statement errors             0
         Validation errors                 1
         Read/OPEN errors                  0
         Configuration errors              0
         Exit requested termination        0
         --------------------------  -------
         Total error count                 2


Ed