IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Bypass a File in JCL if it's not present


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Mon Mar 12, 2007 10:16 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Mar 13, 2007 7:49 pm
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
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
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

Moderator Emeritus


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

PostPosted: Wed Mar 14, 2007 7:28 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top