Author Topic: JCL That I Find Handy  (Read 894 times)

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
JCL That I Find Handy
« 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




Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
Re: JCL That I Find Handy
« Reply #1 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

Ed

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
ARSSTASH - Here's One That Can't Be Solved By JCL
« Reply #2 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

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

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
ARSEXOAM - how do you specify the stash file in JCL?
« Reply #3 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 *********************

Alessandro Perucchi

  • Hero Member
  • *****
  • Posts: 933
    • View Profile
Re: JCL That I Find Handy
« Reply #4 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

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
Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
Putting a Marker in the z/OS System Console Log
« Reply #5 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



Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
Copying HFS files from one directory to another
« Reply #6 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.     

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
Re: JCL That I Find Handy
« Reply #7 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