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
 
Bypass a File in JCL if it's not present

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
mkumarshashi

New User


Joined: 04 Oct 2005
Posts: 3

PostPosted: Mon Mar 12, 2007 11:46 am    Post subject: Bypass a File in JCL if it's not present
Reply with quote

Requirement is:
I have to use three files and copy them to one output file.

This I am doing successfully using ICEMAN utility,
but there should be an check on file. Suppose one of the file is not present then in that job should not abend instead it should use other two files and copy them to fourth file.
Back to top
View user's profile Send private message

IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Mar 12, 2007 5:10 pm    Post subject: Re: Bypass a File in JCL
Reply with quote

If you know the DCBs for your files then you could try this


Code:

//S01      EXEC PGM=IEFBR14                               
//DD1      DD  DSN=YOUR.FIRST.FILE,DISP=(MOD,PASS),       
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,           
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=24000)       
//DD2      DD  DSN=YOUR.SECOND.FILE,DISP=(MOD,PASS),       
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,           
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=24000)       
//DD3      DD  DSN=YOUR.THIRD.FILE,DISP=(MOD,PASS),       
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,           
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=24000)       
//*                                                       
//S02      EXEC PGM=SORT                                   
//SORTIN   DD  DSN=YOUR.FIRST.FILE,DISP=SHR               
//         DD  DSN=YOUR.SECOND.FILE,DISP=SHR               
//         DD  DSN=YOUR.THIRD.FILE,DISP=SHR               


the first step will open but do nothing for any existing datasets
it will create a temporary dataset if there is none to begin with so there will be no JCL errors/abends when you run your sort step.

Does that satisfy your requirement?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 12, 2007 10:16 pm    Post subject:
Reply with quote

Hello,

While this solution prevents the "file not found" error, it will cause problems in many organizations.

If the MOD causes a new file to be created the sort step may abend with a wrong length record or will process with incorrect data (whatever was last on that space on the dasd). If all of your dasd is sms-managed, you may be ok, but it is better to ensure the files exist and have a valid e-o-f.

Please search the forum for other topics with the same situation. It has been discussed recently.
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Tue Mar 13, 2007 3:35 pm    Post subject: Re: Bypass a File in JCL if it's not present
Reply with quote

Thanks Dick
our shop is all SMS managed and it works fine for us, I should have qualified that.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 13, 2007 7:49 pm    Post subject:
Reply with quote

Hi IQ,

Yes, it was an excellent additon to sms that when merely cataloging a dataset (i.e. with IEFBR14) it automatically writes a "real" end-of-file icon_smile.gif

Now, if everything was sms-managed everywhere . . . . icon_wink.gif
Back to top
View user's profile Send private message
mshashio

New User


Joined: 24 Apr 2006
Posts: 4

PostPosted: Wed Mar 14, 2007 2:40 pm    Post subject: Re: Bypass a File in JCL if it's not present
Reply with quote

Thanx for the quick response.
I have done as per suggestion, but I am getting following error whilr running it.
PRODUCT LICENSED FOR CPU SERIAL NUMBER 2A61A, MODEL 2084 305
SYSIN :
SORT FIELDS=COPY
WER164B 6,896K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,004K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER400A SORTIN IS AN UNINITIALIZED SEQUENTIAL DISK DATA SET
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
******************************* BOTTOM OF DATA *********************

Please advise
Back to top
View user's profile Send private message
mshashio

New User


Joined: 24 Apr 2006
Posts: 4

PostPosted: Wed Mar 14, 2007 2:43 pm    Post subject: Re: Bypass a File in JCL if it's not present
Reply with quote

This runs fine when all the files are present in DASD, but when file is not present then SORT step gives error.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 7:28 pm    Post subject:
Reply with quote

Hello,

That is the error i cautioned about. It sounds like your dataset(s) are not sms-managed.

You must mske sure the file has a valid end-of-file. You can do this with IEBGENER or even another SORT step.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

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