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

DISP=NEW/MOD - Issue with output file data


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 3:23 pm
Reply with quote

I am running a JCL and cataloging a dataset with DISP=(NEW,CATLG,DELETE)

When the job completes (maxcc 0), i find that the output DSN is created empty and no records are written in it.

Then i delete the dataset and run the same JCL with DISP=(MOD,CATLG,DELETE) the file now has the output records.

The program that writes the dataset opened it in OUTPUT mode and displays in the program show that the WRITE statement was indeed executed in both the above instances.

Is there any particular reason why this might be happening? I tried searching in the forum but could not find any topic that discusses this.

Thank You.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jul 04, 2013 3:54 pm
Reply with quote

Probably because the program closes the file and reopens it, and with DISP=NEW will obliterate anything already there on the reopen
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Jul 04, 2013 3:59 pm
Reply with quote

Biswajit D,

Were your tests with exactly same input if such an input dataset exists for your job? Also could you show your JCL output DD statements for both runs in "Code" tags.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 04, 2013 4:24 pm
Reply with quote

What program are you executing? Assuming it's about COBOL - as expat said, are you sure OPEN mode is only OUTPUT and done only once?
Back to top
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 4:26 pm
Reply with quote

Yes. Exact same. Just changed the disposition and submitted the job.

First run:
Code:
//FFSI121A DD  DUMMY                                       
//FFSI122A DD  DSN=RACFID.OUTPUT.DATASET,               
//             UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE),         
//             DCB=(RECFM=FB,LRECL=0479,BLKSIZE=00000),     
//             DISP=(NEW,CATLG,DELETE)                     
//FFSI132A DD  DUMMY                                       

After I ran the job for the first time, output dataset got catalogued but was empty. So I deleted the dataset.

Picked up the job from spool, changed the DISP and submitted it. This time the dataset got catalogued with data.
Code:
//FFSI121A DD  DUMMY                                       
//FFSI122A DD  DSN=RACFID.OUTPUT.DATASET,               
//             UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE),         
//             DCB=(RECFM=FB,LRECL=0479,BLKSIZE=00000),     
//             DISP=(MOD,CATLG,DELETE)                     
//FFSI132A DD  DUMMY                                       
Back to top
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Thu Jul 04, 2013 4:31 pm
Reply with quote

Yes. Open statement 1 time and close statement 1 time. Also, these statements are executed only once.
Code:
000046 FILE-CONTROL.
000057     SELECT  I122A-FILE    ASSIGN  UT-S-FFSI122A. 
.
.
000434 PROCEDURE DIVISION.
.
.
000499     OPEN OUTPUT  I122A-FILE.           
.
.
000523     CLOSE I122A-FILE.     
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 04, 2013 4:40 pm
Reply with quote

There is no error then, wait for some time - and things will subside in some time.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Jul 04, 2013 5:29 pm
Reply with quote

Quote:
Yes. Open statement 1 time and close statement 1 time. Also, these statements are executed only once.
The count of open / close statements is irrelevant. And how do you KNOW they are executed only one time? Unless you do something like put DISPLAY statements in the code to prove the number of times they open / close the file, you are merely guessing about the number of executions. The behavior you described sounds precisely and exactly like the file was opened more than one time, and there have been plenty of examples on this forum of code "falling through" and executing statements the TS did not realize were executing.
Back to top
View user's profile Send private message
Dale Robertson

New User


Joined: 21 Jun 2013
Posts: 44
Location: U.S.A.

PostPosted: Mon Jul 15, 2013 10:21 pm
Reply with quote

Biswajit D

Try 2 things. first write a delete step like this:

Code:
//JS1DEL  EXEC  PGM=IEFBR14
//DD1 DD  DSN=RACFID.OUTPUT.DATASET,               
//             SPACE=(TRK,0),DISP=(MOD,DELETE)


put that in your jcl before your cobol program. do that to delete and uncatalog your file. strangely it seems as though the new z/OS is more forgiving and will do that for you like in UNIX however it is safer to do it explicitly so you don't have to keep doing it manually.

Next if you indeed have only run those open/close instructions just once in your program and have written to that file in the mean time then you're okay. in fact you might wish to take advantage of the cobol compiler that has been out there for decades now and not even write the close instruction!!!!!

that's right. the compile will do your work for you. take out
Code:
000523     CLOSE I122A-FILE. 


still make sure you have your open instruction done ONCE and then of course the write instruction done multiple times until your program has "run out of gas".

Then code
Code:
DISP=(,CATLG,DELETE)


also I didn't see an FD. do you have one in your code? also take out the DCB parameters in your JCL as they're already there from your program!!

make sure of course that you have BLOCK 0 in the FD as that really is all you need. remember with cobol - less is better.

r
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
Search our Forums:

Back to Top