Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can i use JCL to check whether a batch files are exist?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
David_Li

New User


Joined: 05 Apr 2006
Posts: 10

PostPosted: Mon Aug 28, 2006 8:04 pm    Post subject: Can i use JCL to check whether a batch files are exist?
Reply with quote

1. More than 1000 records in a dataset (PS), each record is VSAM file name. like this:
*******************************************************
SERS.MSI.FTRSF.TEST1
SERS.MSI.FTRSF.TEST2
SERS.MSI.FTRSF.TEST3
SERS.MSI.FTRSF.TEST4
SERS.MSI.FTRSF.TEST5
SERS.MSI.FTRSF.TEST6
........ .......
SERS.MSI.FTRSF.T1000
*******************************************************
2. I want to know whether these files exist in system. And print the files name which are not in system in dataset 'SERS.MSI.OUTPUT'.

How do i do?

High appreciate with any response.
Back to top
View user's profile Send private message

cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Aug 29, 2006 1:26 am    Post subject: Re: Can i use JCL to check whether a batch files are exist?
Reply with quote

Using IDCAMS, you could take every dataset name and format LISTCAT control cards to see if a dataset exists:

Code:

//DELETE  EXEC PGM=IDCAMS               
//SYSPRINT DD SYSOUT=*                   
//SYSIN    DD *                         
 LISTCAT ENTRY(HLQ.DATASET.NAME.FILE1)
 LISTCAT ENTRY(HLQ.DATASET.NAME.FILE2)
/*                                       


If it exists, the output would look like:
Code:

 LISTCAT ENTRY(HLQ.DATASET.NAME.FILE1) NAME   
NONVSAM ------- HLQ.DATASET.NAME.FILE1


If it does not exist, the output would look like:
Code:

  LISTCAT ENTRY(HLQ.DATASET.NAME.FILE2)
IDC3012I ENTRY HLQ.DATASET.NAME.FILE2 NOT FOUND   


You could write the SYSPRINT output from the IDCAMS step to a permanent dataset, so it could be later edited to identify the "NOT FOUND" files.
Back to top
View user's profile Send private message
crrindia

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Tue Aug 29, 2006 1:03 pm    Post subject: Re: Can i use JCL to check whether a batch files are exist?
Reply with quote

Hi, Here you are providing the Syntax to check individual one by using the LISTCAT parameter. But as per David's note Suppose if we want to check only that PS file(all of the VSAM files exists in that file), and from there it should check all of those VSAM files. For that how to verify it? Please provide sample Syntax also.

Thanks!
Rathna.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Aug 29, 2006 10:35 pm    Post subject: Re: Can i use JCL to check whether a batch files are exist?
Reply with quote

My suggestion was to take the complete list of datasets, format a LISTCAT command using each dataset, and finally run an IDCAMS and write the SYSPRINT results to a dataset.

If you are looking for a single LISTCAT command for listing all datasets that match a specific pattern, you could use:

Code:

 LISTCAT LEVEL('SERS.MSI')


This command will not list missing datasets, only existing ones. If you took the list of existing datasets and placed them sequentially in a dataset starting in position 1. Then take the list of datasets from your original dataset and place them sequentially in a dataset starting in position one.

You could then sort them all together using ICETOOL or SYNCTOOL using the NODUPS option and the output file would be every dataset that didn't match the datasets on your original file.
Back to top
View user's profile Send private message
David_Li

New User


Joined: 05 Apr 2006
Posts: 10

PostPosted: Thu Aug 31, 2006 7:14 pm    Post subject: Can i use JCL to check whether a batch files are exist?
Reply with quote

Thanks, Guys.

Yeah, That is a way to figure out the question with single dataset or a group datasets which have the same High qualify.

I found another way. use REXX. This way also can verify that. Share with you.



Code:
/*REXX*/
    DSNAME = 'SERS.BSP.ERSCICI2.CSD(ERSI2CSD)'
    "ALLOC FI(MYINDD1) DA('"DSNAME"') SHR REUSE"
    "EXECIO * DISKR MYINDD1 (STEM NEWVAR. FINIS"
    "FREE FI(MYINDD1)"
    DO I1 = 1     TO NEWVAR.0
       IF INDEX(NEWVAR.I1,"DEFINE FILE(") > 0 THEN
       DO
          POS2 = INDEX(NEWVAR.I1,")")
          FILE_LENG = POS2 - 13
          FILENAME = SUBSTR(NEWVAR.I1,13,FILE_LENG)
          I1 = I1 + 1
          IF INDEX(NEWVAR.I1,"DSNAME(") > 0 THEN
          DO
             POS2 = INDEX(NEWVAR.I1,")")
             FILE_LENG = POS2 - 15
             PHYFILE   = SUBSTR(NEWVAR.I1,15,FILE_LENG)
       /*    SAY LEFT(FILENAME,12) PHYFILE  */
             XX = SYSDSN("'"PHYFILE"'")
             IF XX \= 'OK' THEN
             DO
                 SAY LEFT(FILENAME,12) PHYFILE
             END
          END
       END
    END
EXIT


Original file: 'SERS.BSP.ERSCICI2.CSD(ERSI2CSD)
************************************************************
..... ......... ............. .............
DEFINE FILE(file name1)

..... ......... ............. .............

DEFINE FILE(file name2)

DEFINE FILE(file name3)
.............................
DEFINE FILE(file name4)

DEFINE FILE(file nameN)
************************************************************
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Generate public-private key in batch ... vasanthz All Other Mainframe Topics 3 Fri Sep 15, 2017 9:20 am
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us