Follow

Working without the LISTCAT verb

One difference between executing JCL and IDCAMS on the mainframe and using Elastic Batch Platform is that EBP does not maintain a "CATALOG" as all the files are either held in the operating system or within a relational store. 

This means that LISTCAT operations can be implemented using standard operating system commands such as "ls", on linux, or "dir" on Windows and there is no need for the LISTCAT verb to be implemented within EBP. 

EBP does contain information about files in a data control block file, ".dcb", found in the directories configured within EBP.  This is a Java property file which holds attributes on the file under the DSN of each file.

A judicious use of some OS utilities allows us to get a list of all the files listed in the ".dcb" and for example add them to a JCL using IDCAMS delete operations. 

For Unix we can use "sed" and "sort" to list all the files referenced within the ".dcb" file in the current working directory

So this command

sed -e 's/\([^-]*\)-.*/\1/' <.dcb | sort -u

will give us output like this

PSMT.PDALS030.A
PSMT.PDALS030.B
PSMT.PDALS030.C
PSMT.PDALS030.D
 
Then in JCL we can make the following entries
 
//DELT0010 EXEC PGM=IDCAMS           
//SYSIN DD *
DEL (PSMT.PDALS030.A)
DEL (PSMT.PDALS030.B)
DEL (PSMT.PDALS030.C)
DEL (PSMT.PDALS030.D)
/*

 

For Windows we can use the all powerful, but slightly verbose, PowerShell to achieve the same result but recursively for all ".dcb" files beneath the current directory.

Get-ChildItem -Path .\** -Filter *.dcb -Recurse | Select-String -Pattern “(^.+?)[^ ](?=-)” | % { $_.Matches[0] } | % { $_.Value } | sort -Unique

 

Of course it may well be that we do not actually need to know the names of the files to be deleted, we just want to clean up. We in that case it is actually very simple just to call out to the command shell and execute operating system delete commands. We can do this directly from JCL.

The following is a sample that just calls the windows command program "echo". It is of course possible to invoke any program or batch or powershell file using this same method

 

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST68 JOB (HCIACCT),'windows cmdshell Test',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(2,2),NOTIFY=&SYSUID
//*
// IF &HLQ='' THEN
// SET HLQ=HCI00 high-level qualifier of DSNs
// ENDIF
//*
//STEP0020 EXEC PGM=IKJEFT1B
//SYSEXEC DD UNIT=SYSALLDA,SPACE=(80,(5,1)),
// DSN=&SYSEXEC..CMD,
// AVGREC=K,DSNTYPE=LIBRARY,
// RECFM=FB,LRECL=80,DSORG=PO
//SYSUT2 DD DISP=(OLD,PASS),VOL=REF=*.SYSEXEC,
// DSN=&SYSEXEC..CMD(CMDSAMP)
//SYSIN DD *
echo hello world
exit
/*
//*
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSERR DD SYSOUT=*
//SYSTSIN DD *
REPRO INFILE(SYSIN) OUTFILE(SYSUT2)
%CMDSAMP shell
/*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk